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 {
None = 0,
Basic = 1,
Extended = 2,
Ansi256 = 2,
TrueColor = 3
}
@ -14,8 +14,8 @@ export interface ChalkOptions {
}
export interface Chalk {
new (options: ChalkOptions): Chalk;
(options: ChalkOptions): Chalk;
new (options?: ChalkOptions): Chalk;
(options?: ChalkOptions): Chalk;
(...text: string[]): string;
(text: TemplateStringsArray, ...placeholders: string[]): string;
constructor: Chalk;

View file

@ -24,9 +24,13 @@ ctx`foo`;
chalk.enabled = true;
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.level;

View file

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