Skip to content

Commit

Permalink
Add missing false type to chalk.supportsColor (#347)
Browse files Browse the repository at this point in the history
  • Loading branch information
loilo authored and sindresorhus committed Jun 10, 2019
1 parent 4ab4665 commit d82b2a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Expand Up @@ -296,7 +296,7 @@ Order doesn't matter, and later styles take precedent in case of a conflict.
This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
*/
declare const chalk: chalk.Chalk & chalk.ChalkFunction & {
supportsColor: chalk.ColorSupport;
supportsColor: chalk.ColorSupport | false;
Level: typeof LevelEnum;
};

Expand Down
7 changes: 4 additions & 3 deletions index.test-d.ts
Expand Up @@ -11,9 +11,10 @@ expectType<number>(chalk.Level.Ansi256);
expectType<number>(chalk.Level.TrueColor);

// - supportsColor -
expectType<boolean>(chalk.supportsColor.hasBasic);
expectType<boolean>(chalk.supportsColor.has256);
expectType<boolean>(chalk.supportsColor.has16m);
expectType<chalk.ColorSupport | false>(chalk.supportsColor);
expectType<boolean>((chalk.supportsColor as chalk.ColorSupport).hasBasic);
expectType<boolean>((chalk.supportsColor as chalk.ColorSupport).has256);
expectType<boolean>((chalk.supportsColor as chalk.ColorSupport).has16m);

// -- `supportsColor` is not a member of the Chalk interface --
expectError(chalk.reset.supportsColor);
Expand Down

0 comments on commit d82b2a6

Please sign in to comment.