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.
|
* 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`.
|
* 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;
|
export default chalk;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ export type Options = {|
|
||||||
level?: Level
|
level?: Level
|
||||||
|};
|
|};
|
||||||
|
|
||||||
export type ColorSupport = {|
|
export type ColorSupport = false | {|
|
||||||
level: Level,
|
level: Level,
|
||||||
hasBasic: boolean,
|
hasBasic: boolean,
|
||||||
has256: boolean,
|
has256: boolean,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import {expectType} from 'tsd-check';
|
||||||
import chalk, {Level, Chalk, ColorSupport} from '.';
|
import chalk, {Level, Chalk, ColorSupport} from '.';
|
||||||
|
|
||||||
// - Helpers -
|
// - Helpers -
|
||||||
type colorReturn = Chalk & {supportsColor: ColorSupport};
|
type colorReturn = Chalk & {supportsColor: false | ColorSupport};
|
||||||
|
|
||||||
// - Level -
|
// - Level -
|
||||||
expectType<number>(Level.None);
|
expectType<number>(Level.None);
|
||||||
|
|
@ -11,9 +11,9 @@ expectType<number>(Level.Ansi256);
|
||||||
expectType<number>(Level.TrueColor);
|
expectType<number>(Level.TrueColor);
|
||||||
|
|
||||||
// - supportsColor -
|
// - supportsColor -
|
||||||
expectType<boolean>(chalk.supportsColor.hasBasic);
|
expectType<boolean>(chalk.supportsColor && chalk.supportsColor.hasBasic);
|
||||||
expectType<boolean>(chalk.supportsColor.has256);
|
expectType<boolean>(chalk.supportsColor && chalk.supportsColor.has256);
|
||||||
expectType<boolean>(chalk.supportsColor.has16m);
|
expectType<boolean>(chalk.supportsColor && chalk.supportsColor.has16m);
|
||||||
|
|
||||||
// - Chalk -
|
// - Chalk -
|
||||||
// -- Constructor --
|
// -- Constructor --
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue