Updated typings
This commit is contained in:
parent
ecf8f86c7c
commit
8046089bc6
2 changed files with 18 additions and 7 deletions
18
types/index.d.ts
vendored
18
types/index.d.ts
vendored
|
|
@ -3,19 +3,27 @@
|
||||||
|
|
||||||
export = chalk;
|
export = chalk;
|
||||||
|
|
||||||
declare function chalk(...text: (string | number)[]): string;
|
declare function chalk(...text: string[]): string;
|
||||||
declare function chalk(text: TemplateStringsArray, ...placeholders: (string | number)[]): string;
|
declare function chalk(text: TemplateStringsArray, ...placeholders: string[]): string;
|
||||||
|
|
||||||
declare namespace chalk {
|
declare namespace chalk {
|
||||||
|
|
||||||
|
export enum ChalkLevel {
|
||||||
|
Disabled = 0,
|
||||||
|
Basic = 1,
|
||||||
|
Extended = 2,
|
||||||
|
TrueColor = 3
|
||||||
|
}
|
||||||
|
|
||||||
interface ChalkConstructorOptions {
|
interface ChalkConstructorOptions {
|
||||||
enabled?: boolean;
|
enabled?: boolean;
|
||||||
level?: number;
|
level?: ChalkLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function constructor(options?: ChalkConstructorOptions): typeof chalk;
|
export function constructor(options?: ChalkConstructorOptions): typeof chalk;
|
||||||
|
|
||||||
export let enabled: boolean;
|
export let enabled: boolean;
|
||||||
export let level: number;
|
export let level: ChalkLevel;
|
||||||
export const supportsColor: boolean;
|
export const supportsColor: boolean;
|
||||||
|
|
||||||
export const hex: (color: string) => typeof chalk;
|
export const hex: (color: string) => typeof chalk;
|
||||||
|
|
@ -50,7 +58,7 @@ declare namespace chalk {
|
||||||
export const cyan: typeof chalk;
|
export const cyan: typeof chalk;
|
||||||
export const white: typeof chalk;
|
export const white: typeof chalk;
|
||||||
export const gray: typeof chalk;
|
export const gray: typeof chalk;
|
||||||
export const grey: typeof chalk;
|
export const grey: typeof gray;
|
||||||
export const blackBright: typeof chalk;
|
export const blackBright: typeof chalk;
|
||||||
export const redBright: typeof chalk;
|
export const redBright: typeof chalk;
|
||||||
export const greenBright: typeof chalk;
|
export const greenBright: typeof chalk;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ 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`;
|
||||||
|
|
@ -15,13 +16,15 @@ chalk.red.bgGreen.underline('foo');
|
||||||
chalk.underline.red.bgGreen('foo');
|
chalk.underline.red.bgGreen('foo');
|
||||||
|
|
||||||
chalk.grey('foo');
|
chalk.grey('foo');
|
||||||
chalk.red(0);
|
|
||||||
|
|
||||||
const ctx = chalk.constructor({level: 1});
|
chalk.constructor({level: 1});
|
||||||
|
const ctx = chalk.constructor({level: chalk.ChalkLevel.TrueColor });
|
||||||
ctx('foo');
|
ctx('foo');
|
||||||
ctx.red('foo');
|
ctx.red('foo');
|
||||||
ctx`foo`;
|
ctx`foo`;
|
||||||
|
|
||||||
|
chalk.level === chalk.ChalkLevel.Extended;
|
||||||
|
|
||||||
chalk.enabled;
|
chalk.enabled;
|
||||||
chalk.supportsColor;
|
chalk.supportsColor;
|
||||||
chalk.level;
|
chalk.level;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue