fix: chalk.constructor typedef
This commit is contained in:
parent
f6b0e45cdd
commit
37a4d594f1
2 changed files with 5 additions and 5 deletions
4
types/index.d.ts
vendored
4
types/index.d.ts
vendored
|
|
@ -13,7 +13,7 @@ export interface ChalkOptions {
|
||||||
level?: Level;
|
level?: Level;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ChalkConstructor extends Chalk {
|
export interface ChalkConstructor {
|
||||||
new (options?: ChalkOptions): Chalk;
|
new (options?: ChalkOptions): Chalk;
|
||||||
(options?: ChalkOptions): Chalk;
|
(options?: ChalkOptions): Chalk;
|
||||||
}
|
}
|
||||||
|
|
@ -28,8 +28,6 @@ export interface ColorSupport {
|
||||||
export interface Chalk {
|
export interface Chalk {
|
||||||
(...text: string[]): string;
|
(...text: string[]): string;
|
||||||
(text: TemplateStringsArray, ...placeholders: string[]): string;
|
(text: TemplateStringsArray, ...placeholders: string[]): string;
|
||||||
new (options?: ChalkOptions): Chalk;
|
|
||||||
(options: ChalkOptions): Chalk;
|
|
||||||
constructor: ChalkConstructor;
|
constructor: ChalkConstructor;
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
level: Level;
|
level: Level;
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,12 @@ chalk.level = Level.Ansi256;
|
||||||
|
|
||||||
chalk.level === Level.Ansi256;
|
chalk.level === Level.Ansi256;
|
||||||
|
|
||||||
let chalkInstance = new chalk();
|
let chalkInstance = new chalk.constructor();
|
||||||
chalkInstance = new chalk.constructor();
|
|
||||||
chalkInstance = chalk.constructor();
|
chalkInstance = chalk.constructor();
|
||||||
|
|
||||||
|
chalkInstance.blue('foo');
|
||||||
|
chalkInstance`foo`;
|
||||||
|
|
||||||
let x = 'imastring';
|
let x = 'imastring';
|
||||||
x = chalk();
|
x = chalk();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue