-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: improve third party type declarations (#276)
- Loading branch information
1 parent
5de7a0d
commit 241ae89
Showing
7 changed files
with
63 additions
and
28 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 |
---|---|---|
@@ -1,10 +1,34 @@ | ||
// @flow | ||
declare module 'chalk' { | ||
declare function blue(source: string): string; | ||
declare function cyan(source: string): string; | ||
// Styles | ||
declare function reset(source: string): string; | ||
declare function bold(source: string): string; | ||
declare function dim(source: string): string; | ||
declare function green(source: string): string; | ||
declare function magenta(source: string): string; | ||
declare function italic(source: string): string; | ||
declare function underline(source: string): string; | ||
declare function inverse(source: string): string; | ||
declare function hidden(source: string): string; | ||
declare function strikethrough(source: string): string; | ||
declare function black(source: string): string; | ||
declare function red(source: string): string; | ||
declare function green(source: string): string; | ||
declare function yellow(source: string): string; | ||
declare function blue(source: string): string; | ||
declare function magenta(source: string): string; | ||
declare function cyan(source: string): string; | ||
declare function white(source: string): string; | ||
declare function gray(source: string): string; | ||
declare function grey(source: string): string; | ||
declare function bgBlack(source: string): string; | ||
declare function bgRed(source: string): string; | ||
declare function bgGreen(source: string): string; | ||
declare function bgYellow(source: string): string; | ||
declare function bgBlue(source: string): string; | ||
declare function bgMagenta(source: string): string; | ||
declare function bgCyan(source: string): string; | ||
declare function bgWhit(source: string): string; | ||
|
||
// Utils | ||
declare function hasColor(source: string): boolean; | ||
declare function stripColor(source: string): string; | ||
} |
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 |
---|---|---|
@@ -1,16 +1,13 @@ | ||
// @flow | ||
declare module 'events' { | ||
declare class EventEmitter { | ||
static listenerCount(emitter: EventEmitter, event: string): number; | ||
|
||
addListener(event: string, listener: Function): EventEmitter; | ||
emit(event: string, ...args:Array<any>): boolean; | ||
listeners(event: string): Array<Function>; | ||
listenerCount(event: string): number; | ||
on(event: string, listener: Function): EventEmitter; | ||
once(event: string, listener: Function): EventEmitter; | ||
removeAllListeners(event?: string): EventEmitter; | ||
removeListener(event: string, listener: Function): EventEmitter; | ||
setMaxListeners(n: number): void; | ||
/** | ||
* NOTE: This is a temporary fix until the following facebook/flow PR is merged | ||
* https://github.com/facebook/flow/pull/2201 | ||
*/ | ||
declare module 'events' { | ||
declare class EventEmitter extends events$EventEmitter { | ||
static EventEmitter: typeof EventEmitter; | ||
} | ||
|
||
declare var exports: typeof EventEmitter; | ||
} |
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 |
---|---|---|
@@ -1,9 +1,25 @@ | ||
// @flow | ||
declare module 'inflection' { | ||
declare function camelize(source: string, lower: boolean): string; | ||
declare function classify(source: string): string; | ||
declare function indexOf<T: Object>( | ||
arr: Array<T>, | ||
item: T, | ||
fromIndex?: number, | ||
compareFunc?: Function | ||
): string; | ||
|
||
declare function pluralize(source: string, plural?: string): string; | ||
declare function singularize(source: string, singular?: string): string; | ||
declare function inflect(source: string): string; | ||
declare function camelize(source: string, lowerFirst?: boolean): string; | ||
declare function underscore(source: string, allUpperCase?: boolean): string; | ||
declare function humanize(source: string, lowerFirst?: boolean): string; | ||
declare function capitalize(source: string): string; | ||
declare function dasherize(source: string): string; | ||
declare function pluralize(source: string): string; | ||
declare function singularize(source: string): string; | ||
declare function underscore(source: string, upper: boolean): string; | ||
declare function titleize(source: string): string; | ||
declare function demodulize(source: string): string; | ||
declare function tableize(source: string): string; | ||
declare function classify(source: string): string; | ||
declare function foreign_key(source: string, lowerFirst?: boolean): string; | ||
declare function ordinalize(source: string): string; | ||
declare function transform(source: string, transforms: Array<string>): string; | ||
} |
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