fix: prompts Choice types aren't correct (#44437)

* fix: prompts Choice types aren't correct

* Update prompts-tests.ts
This commit is contained in:
John Reilly 2020-05-02 17:17:29 +01:00 committed by GitHub
parent e0465ecda7
commit 0d04fc9671
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -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;
}

View File

@ -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'
},
]
}
]);