-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade to [email protected] / fix some typings (#2307)
* Adds inquirer libdefs for more exact typings * Refine / Fix some flowtype errors (mostly in __tests__) * Fix a small bug in src/util/map.js found by [email protected]
- Loading branch information
Showing
7 changed files
with
103 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe | |
unsafe.enable_getters_and_setters=true | ||
|
||
[version] | ||
0.33.0 | ||
^0.37 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// flow-typed signature: df3baa8dc9948e006e9b73243d290c89 | ||
// flow-typed version: 25ed2d5c85/inquirer_v2.x.x/flow_>=v0.25.x | ||
|
||
// FIXME(ryyppy): Add Observable stuff | ||
// -> https://github.com/SBoudrias/Inquirer.js/#reactive-interface | ||
// Currently, if you are using Observables, you need to : any suffix | ||
// the questions input for now | ||
|
||
declare module 'inquirer' { | ||
declare class BottomBar { | ||
log: stream$Writable; | ||
updateBottomBar(input: mixed): void; | ||
} | ||
|
||
declare type SessionT = any; | ||
|
||
declare type AnswersT = { | ||
[key: string]: ?boolean | ?string | ?{ | ||
confirm?: boolean, | ||
input?: string, | ||
rawList?: string, | ||
list?: string, | ||
} | ||
}; | ||
|
||
declare class Separator { | ||
constructor(sep ?: string): void; | ||
} | ||
|
||
declare type ChoiceT = string | Separator | { | ||
name: string, | ||
value?: string, | ||
short?: string, | ||
}; | ||
|
||
declare type QuestionKindT = | ||
'input' | ||
| 'confirm' | ||
| 'list' | ||
| 'rawlist' | ||
| 'expand' | ||
| 'checkbox' | ||
| 'password' | ||
| 'editor'; | ||
|
||
declare type DefaultValueT = string | number | Array<string|number>; | ||
|
||
declare type BasicT = string | number | boolean; | ||
|
||
declare type QuestionT = { | ||
type: QuestionKindT, | ||
name: string, | ||
message: string | (a: AnswersT) => void, | ||
default?: mixed | (a: AnswersT) => mixed, | ||
choices?: Array<ChoiceT>, | ||
|
||
// true => okay | ||
// false => general error message | ||
// string => specific error message | ||
validate?: (input: string | Array<string>) => (boolean | string), | ||
filter?: (input: string) => BasicT | Promise<BasicT>, | ||
when?: boolean | (answers: AnswersT) => (boolean | Promise<boolean>), | ||
pageSize?: number, | ||
}; | ||
|
||
declare interface Prompt extends Promise<AnswersT> { | ||
ui: { | ||
process: any, // For observable interface | ||
}, | ||
} | ||
|
||
declare type PromptFn = (questions: QuestionT | Array<QuestionT>) => Prompt; | ||
|
||
declare module.exports: { | ||
Separator: typeof Separator, | ||
prompt: PromptFn, | ||
ui: { | ||
BottomBar: typeof BottomBar, | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters