From cf6615647a55d5f0b8ff1c36f06faee6b22e3221 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Wed, 26 Dec 2018 02:25:23 +0100 Subject: [PATCH] Type definition improvements --- index.d.ts | 13 ++++++------- index.js.flow | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/index.d.ts b/index.d.ts index f08f46d..f2a1149 100644 --- a/index.d.ts +++ b/index.d.ts @@ -29,9 +29,8 @@ export interface Options { enabled?: boolean; /** - * Specify the color support for Chalk. By default, - * color support is automatically detected based on - * the environment. + * Specify the color support for Chalk. + * By default, color support is automatically detected based on the environment. */ level?: Level; } @@ -91,9 +90,8 @@ export interface Chalk { enabled: boolean; /** - * The color support for Chalk. By default, color - * support is automatically detected based on the - * environment. + * The color support for Chalk. + * By default, color support is automatically detected based on the environment. */ level: Level; @@ -230,7 +228,8 @@ export interface Chalk { readonly strikethrough: this; /** - * Modifier: Prints the text only when Chalk is enabled. Can be useful for things that are purely cosmetic. + * Modifier: Prints the text only when Chalk is enabled. + * Can be useful for things that are purely cosmetic. */ readonly visible: this; diff --git a/index.js.flow b/index.js.flow index 622caaa..aac750e 100644 --- a/index.js.flow +++ b/index.js.flow @@ -9,7 +9,7 @@ export type Level = $Values<{ TrueColor: 3 }>; -export type ChalkOptions = {| +export type Options = {| enabled?: boolean, level?: Level |}; @@ -24,19 +24,19 @@ export type ColorSupport = {| export interface Chalk { (...text: string[]): string, (text: TemplateStringsArray, ...placeholders: string[]): string, - constructor(options?: ChalkOptions): Chalk, + constructor(options?: Options): Chalk, enabled: boolean, level: Level, - rgb(r: number, g: number, b: number): Chalk, - hsl(h: number, s: number, l: number): Chalk, - hsv(h: number, s: number, v: number): Chalk, - hwb(h: number, w: number, b: number): Chalk, + rgb(red: number, green: number, blue: number): Chalk, + hsl(hue: number, saturation: number, lightness: number): Chalk, + hsv(hue: number, saturation: number, value: number): Chalk, + hwb(hue: number, whiteness: number, blackness: number): Chalk, bgHex(color: string): Chalk, bgKeyword(color: string): Chalk, - bgRgb(r: number, g: number, b: number): Chalk, - bgHsl(h: number, s: number, l: number): Chalk, - bgHsv(h: number, s: number, v: number): Chalk, - bgHwb(h: number, w: number, b: number): Chalk, + bgRgb(red: number, green: number, blue: number): Chalk, + bgHsl(hue: number, saturation: number, lightness: number): Chalk, + bgHsv(hue: number, saturation: number, value: number): Chalk, + bgHwb(hue: number, whiteness: number, blackness: number): Chalk, hex(color: string): Chalk, keyword(color: string): Chalk, @@ -85,7 +85,7 @@ export interface Chalk { +bgBlueBright: Chalk, +bgMagentaBright: Chalk, +bgCyanBright: Chalk, - +bgWhiteBrigh: Chalk, + +bgWhiteBright: Chalk, supportsColor: ColorSupport };