import { describe, expectTypeOf, test } from 'vitest' import type { InputOptions, RpgPlayer } from '../src' describe('player.showInput types', () => { test('infers the result from the input options', () => { const assertions = (player: RpgPlayer) => { expectTypeOf(player.showInput('Name')).toEqualTypeOf>() expectTypeOf(player.showInput('Password', { type: 'password' })).toEqualTypeOf>() expectTypeOf(player.showInput('Biography', { control: 'textarea', rows: 6 })).toEqualTypeOf>() expectTypeOf(player.showInput('Age', { type: 'number', required: true })).toEqualTypeOf>() expectTypeOf(player.showText('Age?', { input: { type: 'number', required: true } })).toEqualTypeOf>() expectTypeOf(player.showText('Biography?', { input: { control: 'textarea', rows: 6 } })).toEqualTypeOf>() const dynamicOptions = {} as InputOptions expectTypeOf(player.showInput('Dynamic', dynamicOptions)).toEqualTypeOf>() } expectTypeOf(assertions).toBeFunction() }) })