Fix TypeScript types for supportsColor which is top‑level only (#342)
Co-Authored-By: Dimitri Benin <BendingBender@users.noreply.github.com>
This commit is contained in:
parent
d3be9c65b1
commit
b3e9b91405
2 changed files with 79 additions and 60 deletions
|
|
@ -1,8 +1,8 @@
|
|||
import {expectType} from 'tsd';
|
||||
import {expectType, expectError} from 'tsd';
|
||||
import chalk = require('.');
|
||||
|
||||
// - Helpers -
|
||||
type colorReturn = chalk.Chalk & {supportsColor: chalk.ColorSupport};
|
||||
type colorReturn = chalk.Chalk & {supportsColor?: never};
|
||||
|
||||
// - Level -
|
||||
expectType<number>(chalk.Level.None);
|
||||
|
|
@ -15,6 +15,9 @@ expectType<boolean>(chalk.supportsColor.hasBasic);
|
|||
expectType<boolean>(chalk.supportsColor.has256);
|
||||
expectType<boolean>(chalk.supportsColor.has16m);
|
||||
|
||||
// -- `supportsColor` is not a member of the Chalk interface --
|
||||
expectError(chalk.reset.supportsColor);
|
||||
|
||||
// - Chalk -
|
||||
// -- Instance --
|
||||
expectType<chalk.Chalk>(new chalk.Instance({level: 1}));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue