diff --git a/index.d.ts b/index.d.ts index b42e4c0..b2c7213 100644 --- a/index.d.ts +++ b/index.d.ts @@ -68,9 +68,9 @@ export interface ColorSupport { } export interface Chalk { - (...text: string[]): string; + (...text: unknown[]): string; - (text: TemplateStringsArray, ...placeholders: string[]): string; + (text: TemplateStringsArray, ...placeholders: unknown[]): string; /** * Return a new Chalk instance. diff --git a/index.js.flow b/index.js.flow index aac750e..1a3099d 100644 --- a/index.js.flow +++ b/index.js.flow @@ -23,7 +23,7 @@ export type ColorSupport = {| export interface Chalk { (...text: string[]): string, - (text: TemplateStringsArray, ...placeholders: string[]): string, + (text: TemplateStringsArray, ...placeholders: mixed[]): string, constructor(options?: Options): Chalk, enabled: boolean, level: Level, diff --git a/index.test-d.ts b/index.test-d.ts index 6cda4da..5920526 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -27,6 +27,7 @@ expectType(chalk.level); expectType(chalk``); const name = 'John'; expectType(chalk`Hello {bold.red ${name}}`); +expectType(chalk`Works with numbers {bold.red ${1}}`); // -- Color methods -- expectType(chalk.hex('#DEADED')); diff --git a/test/_flow.js b/test/_flow.js index 2cf3cf2..ac76e85 100644 --- a/test/_flow.js +++ b/test/_flow.js @@ -9,10 +9,6 @@ chalk.constructor({level: 1}); new chalk.constructor({enabled: 'true'}); new chalk.constructor({enabled: true}); -// $ExpectError (Can't pass in null) -chalk.underline(null); -chalk.underline('foo'); - // $ExpectError (Can't have typo in chalk method) chalk.rd('foo'); chalk.red('foo'); @@ -29,10 +25,6 @@ chalk.red.bgBlue.underline('foo'); const badCtx = chalk.constructor({level: 4}); const ctx = chalk.constructor({level: 3}); -// $ExpectError (Can't pass in null) -ctx(null); -ctx('foo'); - // $ExpectError (Can't have typo in method name) ctx.gry('foo'); ctx.grey('foo');