Skip to content

Commit

Permalink
fix type on the flow types for "chalk"
Browse files Browse the repository at this point in the history
Summary:
X-link: facebook/react-native#49814

`bgWhiteBrigh + t = bgWhiteBright`
seems like no one was using `chalk.bgWhiteBright` before me :)

Changelog:
[General][Internal] fix type on the flow types for "chalk"

Reviewed By: huntie, hoxyq

Differential Revision: D70403987

fbshipit-source-id: 34f65e57fbb2eeadd6030557e0499db0b2603b38
  • Loading branch information
vzaidman authored and facebook-github-bot committed Mar 4, 2025
1 parent c890ad5 commit 91ea36b
Showing 1 changed file with 127 additions and 4 deletions.
131 changes: 127 additions & 4 deletions packages/flow-dev-tools/flow-typed/npm/chalk_v4.x.x.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,62 @@
// flow-typed signature: 5096c316b7092ffc5ddc487d26c0d6a4
// flow-typed version: f2e3dcf9e8/chalk_v4.x.x/flow_>=v0.104.x
// flow-typed signature: 79cfa6bcaa67fdb60f10d320da0470fc
// flow-typed version: 6cecea2e51/chalk_v4.x.x/flow_>=v0.104.x

// From: https://github.com/chalk/chalk/blob/master/index.d.ts

declare module "chalk" {
declare type ForegroundColor =
| 'black'
| 'red'
| 'green'
| 'yellow'
| 'blue'
| 'magenta'
| 'cyan'
| 'white'
| 'gray'
| 'grey'
| 'blackBright'
| 'redBright'
| 'greenBright'
| 'yellowBright'
| 'blueBright'
| 'magentaBright'
| 'cyanBright'
| 'whiteBright';

declare type BackgroundColor =
| 'bgBlack'
| 'bgRed'
| 'bgGreen'
| 'bgYellow'
| 'bgBlue'
| 'bgMagenta'
| 'bgCyan'
| 'bgWhite'
| 'bgGray'
| 'bgGrey'
| 'bgBlackBright'
| 'bgRedBright'
| 'bgGreenBright'
| 'bgYellowBright'
| 'bgBlueBright'
| 'bgMagentaBright'
| 'bgCyanBright'
| 'bgWhiteBright';

declare type Color = ForegroundColor | BackgroundColor;

declare type Modifiers =
| 'reset'
| 'bold'
| 'dim'
| 'italic'
| 'underline'
| 'inverse'
| 'hidden'
| 'strikethrough'
| 'visible';

declare type TemplateStringsArray = $ReadOnlyArray<string>;

declare type Level = $Values<{
Expand All @@ -25,10 +78,80 @@ declare module "chalk" {
has16m: boolean
|};

declare class Instance implements Chalk {
constructor(options?: ChalkOptions): this;

(...text: string[]): string,
(text: TemplateStringsArray, ...placeholders: string[]): string,
Instance: typeof Instance,
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,
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,
hex(color: string): Chalk,
keyword(color: string): Chalk,

+reset: Chalk,
+bold: Chalk,
+dim: Chalk,
+italic: Chalk,
+underline: Chalk,
+inverse: Chalk,
+hidden: Chalk,
+strikethrough: Chalk,

+visible: Chalk,

+black: Chalk,
+red: Chalk,
+green: Chalk,
+yellow: Chalk,
+blue: Chalk,
+magenta: Chalk,
+cyan: Chalk,
+white: Chalk,
+gray: Chalk,
+grey: Chalk,
+blackBright: Chalk,
+redBright: Chalk,
+greenBright: Chalk,
+yellowBright: Chalk,
+blueBright: Chalk,
+magentaBright: Chalk,
+cyanBright: Chalk,
+whiteBright: Chalk,

+bgBlack: Chalk,
+bgRed: Chalk,
+bgGreen: Chalk,
+bgYellow: Chalk,
+bgBlue: Chalk,
+bgMagenta: Chalk,
+bgCyan: Chalk,
+bgWhite: Chalk,
+bgBlackBright: Chalk,
+bgRedBright: Chalk,
+bgGreenBright: Chalk,
+bgYellowBright: Chalk,
+bgBlueBright: Chalk,
+bgMagentaBright: Chalk,
+bgCyanBright: Chalk,
+bgWhiteBright: Chalk,

supportsColor: ColorSupport
}

declare interface Chalk {
(...text: string[]): string,
(text: TemplateStringsArray, ...placeholders: string[]): string,
Instance(options?: ChalkOptions): Chalk,
Instance: typeof Instance,
level: Level,
rgb(r: number, g: number, b: number): Chalk,
hsl(h: number, s: number, l: number): Chalk,
Expand Down Expand Up @@ -88,7 +211,7 @@ declare module "chalk" {
+bgBlueBright: Chalk,
+bgMagentaBright: Chalk,
+bgCyanBright: Chalk,
+bgWhiteBrigh: Chalk,
+bgWhiteBright: Chalk,

supportsColor: ColorSupport
}
Expand Down

0 comments on commit 91ea36b

Please sign in to comment.