mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
fix: prompts Choice types aren't correct (#44437)
* fix: prompts Choice types aren't correct * Update prompts-tests.ts
This commit is contained in:
parent
e0465ecda7
commit
0d04fc9671
5
types/prompts/index.d.ts
vendored
5
types/prompts/index.d.ts
vendored
@ -5,6 +5,7 @@
|
||||
// Kamontat Chantrachirathumrong <https://github.com/kamontat>
|
||||
// theweirdone <https://github.com/theweirdone>
|
||||
// whoaa512 <https://github.com/whoaa512>
|
||||
// John Reilly <https://github.com/johnnyreilly>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.9
|
||||
|
||||
@ -55,10 +56,12 @@ declare namespace prompts {
|
||||
function toggle(args: PromptObject): void;
|
||||
}
|
||||
|
||||
// Based upon: https://github.com/terkelg/prompts/blob/d7d2c37a0009e3235b2e88a7d5cdbb114ac271b2/lib/elements/select.js#L29
|
||||
interface Choice {
|
||||
title: string;
|
||||
value: any;
|
||||
disable?: boolean;
|
||||
disabled?: boolean;
|
||||
selected?: boolean;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
|
||||
@ -39,9 +39,16 @@ type HasProperty<T, K> = K extends keyof T ? true : false;
|
||||
value: 'A'
|
||||
},
|
||||
{
|
||||
title: 'A',
|
||||
title: 'B',
|
||||
value: {foo: 'bar'}
|
||||
},
|
||||
{
|
||||
title: 'C',
|
||||
value: 'C',
|
||||
disabled: false,
|
||||
selected: false,
|
||||
description: 'a description'
|
||||
},
|
||||
]
|
||||
}
|
||||
]);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user