Skip to content

Commit d82b2a6

Browse files
loilosindresorhus
authored andcommitted
Add missing false type to chalk.supportsColor (#347)
1 parent 4ab4665 commit d82b2a6

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ Order doesn't matter, and later styles take precedent in case of a conflict.
296296
This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
297297
*/
298298
declare const chalk: chalk.Chalk & chalk.ChalkFunction & {
299-
supportsColor: chalk.ColorSupport;
299+
supportsColor: chalk.ColorSupport | false;
300300
Level: typeof LevelEnum;
301301
};
302302

index.test-d.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ expectType<number>(chalk.Level.Ansi256);
1111
expectType<number>(chalk.Level.TrueColor);
1212

1313
// - supportsColor -
14-
expectType<boolean>(chalk.supportsColor.hasBasic);
15-
expectType<boolean>(chalk.supportsColor.has256);
16-
expectType<boolean>(chalk.supportsColor.has16m);
14+
expectType<chalk.ColorSupport | false>(chalk.supportsColor);
15+
expectType<boolean>((chalk.supportsColor as chalk.ColorSupport).hasBasic);
16+
expectType<boolean>((chalk.supportsColor as chalk.ColorSupport).has256);
17+
expectType<boolean>((chalk.supportsColor as chalk.ColorSupport).has16m);
1718

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

0 commit comments

Comments
 (0)