Updated TS interfaces
This commit is contained in:
parent
8046089bc6
commit
e35b732597
2 changed files with 8 additions and 9 deletions
12
types/index.d.ts
vendored
12
types/index.d.ts
vendored
|
|
@ -8,22 +8,22 @@ declare function chalk(text: TemplateStringsArray, ...placeholders: string[]): s
|
||||||
|
|
||||||
declare namespace chalk {
|
declare namespace chalk {
|
||||||
|
|
||||||
export enum ChalkLevel {
|
export enum Level {
|
||||||
Disabled = 0,
|
None = 0,
|
||||||
Basic = 1,
|
Basic = 1,
|
||||||
Extended = 2,
|
Extended = 2,
|
||||||
TrueColor = 3
|
TrueColor = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ChalkConstructorOptions {
|
interface ConstructorOptions {
|
||||||
enabled?: boolean;
|
enabled?: boolean;
|
||||||
level?: ChalkLevel;
|
level?: Level;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function constructor(options?: ChalkConstructorOptions): typeof chalk;
|
export function constructor(options?: ConstructorOptions): typeof chalk;
|
||||||
|
|
||||||
export let enabled: boolean;
|
export let enabled: boolean;
|
||||||
export let level: ChalkLevel;
|
export let level: Level;
|
||||||
export const supportsColor: boolean;
|
export const supportsColor: boolean;
|
||||||
|
|
||||||
export const hex: (color: string) => typeof chalk;
|
export const hex: (color: string) => typeof chalk;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ chalk.red('foo');
|
||||||
chalk.bgRed('foo');
|
chalk.bgRed('foo');
|
||||||
|
|
||||||
const name = 'Josh';
|
const name = 'Josh';
|
||||||
const number = 0;
|
|
||||||
chalk`Hello {bold.red ${name}}`;
|
chalk`Hello {bold.red ${name}}`;
|
||||||
|
|
||||||
chalk.red`foo`;
|
chalk.red`foo`;
|
||||||
|
|
@ -18,12 +17,12 @@ chalk.underline.red.bgGreen('foo');
|
||||||
chalk.grey('foo');
|
chalk.grey('foo');
|
||||||
|
|
||||||
chalk.constructor({level: 1});
|
chalk.constructor({level: 1});
|
||||||
const ctx = chalk.constructor({level: chalk.ChalkLevel.TrueColor });
|
const ctx = chalk.constructor({level: chalk.Level.TrueColor });
|
||||||
ctx('foo');
|
ctx('foo');
|
||||||
ctx.red('foo');
|
ctx.red('foo');
|
||||||
ctx`foo`;
|
ctx`foo`;
|
||||||
|
|
||||||
chalk.level === chalk.ChalkLevel.Extended;
|
chalk.level === chalk.Level.Extended;
|
||||||
|
|
||||||
chalk.enabled;
|
chalk.enabled;
|
||||||
chalk.supportsColor;
|
chalk.supportsColor;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue