Use CommonJS compatible export in TypeScript definition

This commit is contained in:
Dimitri Benin 2019-04-27 18:03:10 +02:00
parent 7b9211be50
commit a2f90271ae
5 changed files with 281 additions and 274 deletions

View file

@ -1,14 +1,14 @@
import {expectType} from 'tsd-check';
import chalk, {Level, Chalk, ColorSupport} from '.';
import {expectType} from 'tsd';
import chalk = require('.');
// - Helpers -
type colorReturn = Chalk & {supportsColor: ColorSupport};
type colorReturn = chalk.Chalk & {supportsColor: chalk.ColorSupport};
// - Level -
expectType<number>(Level.None);
expectType<number>(Level.Basic);
expectType<number>(Level.Ansi256);
expectType<number>(Level.TrueColor);
expectType<number>(chalk.Level.None);
expectType<number>(chalk.Level.Basic);
expectType<number>(chalk.Level.Ansi256);
expectType<number>(chalk.Level.TrueColor);
// - supportsColor -
expectType<boolean>(chalk.supportsColor.hasBasic);
@ -17,11 +17,11 @@ expectType<boolean>(chalk.supportsColor.has16m);
// - Chalk -
// -- Instance --
expectType<Chalk>(new chalk.Instance({level: 1}));
expectType<chalk.Chalk>(new chalk.Instance({level: 1}));
// -- Properties --
expectType<boolean>(chalk.enabled);
expectType<Level>(chalk.level);
expectType<chalk.Level>(chalk.level);
// -- Template literal --
expectType<string>(chalk``);