mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Update prompts-tests.ts
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
import prompts = require("prompts");
|
||||
|
||||
const response = prompts({
|
||||
type: 'number',
|
||||
name: 'value',
|
||||
message: 'Input value to double:',
|
||||
validate: (value: any) => value < 0 ? `Cant be less than zero` : true
|
||||
});
|
||||
type HasProperty<T, K> = K extends keyof T ? true : false;
|
||||
|
||||
(async () => {
|
||||
const response = await prompts({
|
||||
type: "number",
|
||||
name: "value",
|
||||
message: "Input value to double:",
|
||||
validate: (value: any) => (value < 0 ? `Cant be less than zero` : true)
|
||||
});
|
||||
const HasPropValue: HasProperty<typeof response, "value"> = true;
|
||||
const DoesntHavePropAsdf: HasProperty<typeof response, "asdf"> = false;
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user