parent
6be301b1a4
commit
b1322eacd0
3 changed files with 6 additions and 6 deletions
2
index.d.ts
vendored
2
index.d.ts
vendored
|
|
@ -271,6 +271,6 @@ export interface Chalk {
|
|||
* 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 & { supportsColor: ColorSupport };
|
||||
declare const chalk: Chalk & { supportsColor: false | ColorSupport };
|
||||
|
||||
export default chalk;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export type Options = {|
|
|||
level?: Level
|
||||
|};
|
||||
|
||||
export type ColorSupport = {|
|
||||
export type ColorSupport = false | {|
|
||||
level: Level,
|
||||
hasBasic: boolean,
|
||||
has256: boolean,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import {expectType} from 'tsd-check';
|
|||
import chalk, {Level, Chalk, ColorSupport} from '.';
|
||||
|
||||
// - Helpers -
|
||||
type colorReturn = Chalk & {supportsColor: ColorSupport};
|
||||
type colorReturn = Chalk & {supportsColor: false | ColorSupport};
|
||||
|
||||
// - Level -
|
||||
expectType<number>(Level.None);
|
||||
|
|
@ -11,9 +11,9 @@ expectType<number>(Level.Ansi256);
|
|||
expectType<number>(Level.TrueColor);
|
||||
|
||||
// - supportsColor -
|
||||
expectType<boolean>(chalk.supportsColor.hasBasic);
|
||||
expectType<boolean>(chalk.supportsColor.has256);
|
||||
expectType<boolean>(chalk.supportsColor.has16m);
|
||||
expectType<boolean>(chalk.supportsColor && chalk.supportsColor.hasBasic);
|
||||
expectType<boolean>(chalk.supportsColor && chalk.supportsColor.has256);
|
||||
expectType<boolean>(chalk.supportsColor && chalk.supportsColor.has16m);
|
||||
|
||||
// - Chalk -
|
||||
// -- Constructor --
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue