Updated TS interfaces

This commit is contained in:
Thomas Sauer 2017-07-03 00:05:36 +02:00 committed by calebboyd
parent ec7b0750c8
commit ffc1878305
2 changed files with 8 additions and 9 deletions

12
types/index.d.ts vendored
View file

@ -8,22 +8,22 @@ declare function chalk(text: TemplateStringsArray, ...placeholders: string[]): s
declare namespace chalk {
export enum ChalkLevel {
Disabled = 0,
export enum Level {
None = 0,
Basic = 1,
Extended = 2,
TrueColor = 3
}
interface ChalkConstructorOptions {
interface ConstructorOptions {
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 level: ChalkLevel;
export let level: Level;
export const supportsColor: boolean;
export const hex: (color: string) => typeof chalk;

View file

@ -5,7 +5,6 @@ chalk.red('foo');
chalk.bgRed('foo');
const name = 'Josh';
const number = 0;
chalk`Hello {bold.red ${name}}`;
chalk.red`foo`;
@ -18,12 +17,12 @@ chalk.underline.red.bgGreen('foo');
chalk.grey('foo');
chalk.constructor({level: 1});
const ctx = chalk.constructor({level: chalk.ChalkLevel.TrueColor });
const ctx = chalk.constructor({level: chalk.Level.TrueColor });
ctx('foo');
ctx.red('foo');
ctx`foo`;
chalk.level === chalk.ChalkLevel.Extended;
chalk.level === chalk.Level.Extended;
chalk.enabled;
chalk.supportsColor;