fix(types): optional chalkOptions, Extended -> Ansi256

This commit is contained in:
calebboyd 2017-10-16 15:01:51 -05:00
parent 98b42414b4
commit 64f592b70c
3 changed files with 14 additions and 10 deletions

6
types/index.d.ts vendored
View file

@ -4,7 +4,7 @@
export const enum Level { export const enum Level {
None = 0, None = 0,
Basic = 1, Basic = 1,
Extended = 2, Ansi256 = 2,
TrueColor = 3 TrueColor = 3
} }
@ -14,8 +14,8 @@ export interface ChalkOptions {
} }
export interface Chalk { export interface Chalk {
new (options: ChalkOptions): Chalk; new (options?: ChalkOptions): Chalk;
(options: ChalkOptions): Chalk; (options?: ChalkOptions): Chalk;
(...text: string[]): string; (...text: string[]): string;
(text: TemplateStringsArray, ...placeholders: string[]): string; (text: TemplateStringsArray, ...placeholders: string[]): string;
constructor: Chalk; constructor: Chalk;

View file

@ -24,9 +24,13 @@ ctx`foo`;
chalk.enabled = true; chalk.enabled = true;
chalk.level = 1; chalk.level = 1;
chalk.level = Level.Extended; chalk.level = Level.Ansi256;
chalk.level === Level.Extended; chalk.level === Level.Ansi256;
let chalkInstance = new chalk();
chalkInstance = new chalk.constructor();
chalkInstance = chalk.constructor();
chalk.enabled; chalk.enabled;
chalk.level; chalk.level;

View file

@ -1,9 +1,9 @@
{ {
"compilerOptions": { "compilerOptions": {
"module": "commonjs", "module": "commonjs",
"target": "es6", "target": "es6",
"noImplicitAny": true, "noImplicitAny": true,
"noEmit": true, "noEmit": true,
"allowJs": true "allowJs": true
} }
} }