Deprecated current style names in favor of using Name suffix

This commit is contained in:
LitoMore 2022-10-11 22:40:12 +08:00
parent 553c46871a
commit 8011f5f507
No known key found for this signature in database
GPG key ID: B8653F9344667340
4 changed files with 107 additions and 23 deletions

View file

@ -1,5 +1,8 @@
import {expectType, expectAssignable, expectError} from 'tsd';
import chalk, {Chalk, ChalkInstance, Modifiers, ForegroundColor, BackgroundColor, Color, ColorInfo, ColorSupport, ColorSupportLevel, chalkStderr, supportsColor, supportsColorStderr} from './index.js';
import {expectType, expectAssignable, expectError, expectDeprecated} from 'tsd';
import chalk, {
Chalk, ChalkInstance, ColorInfo, ColorSupport, ColorSupportLevel, chalkStderr, supportsColor, supportsColorStderr,
ModifierName, ForegroundColorName, BackgroundColorName, ColorName,
} from './index.js';
// - supportsColor -
expectType<ColorInfo>(supportsColor);
@ -142,19 +145,19 @@ expectType<string>(chalk.red.bgGreen.bold`Hello {italic.blue ${name}}`);
expectType<string>(chalk.strikethrough.cyanBright.bgBlack`Works with {reset {bold numbers}} {bold.red ${1}}`);
// -- Modifiers types
expectAssignable<Modifiers>('strikethrough');
expectError<Modifiers>('delete');
expectAssignable<ModifierName>('strikethrough');
expectError<ModifierName>('delete');
// -- Foreground types
expectAssignable<ForegroundColor>('red');
expectError<ForegroundColor>('pink');
expectAssignable<ForegroundColorName>('red');
expectError<ForegroundColorName>('pink');
// -- Background types
expectAssignable<BackgroundColor>('bgRed');
expectError<BackgroundColor>('bgPink');
expectAssignable<BackgroundColorName>('bgRed');
expectError<BackgroundColorName>('bgPink');
// -- Color types --
expectAssignable<Color>('red');
expectAssignable<Color>('bgRed');
expectError<Color>('hotpink');
expectError<Color>('bgHotpink');
expectAssignable<ColorName>('red');
expectAssignable<ColorName>('bgRed');
expectError<ColorName>('hotpink');
expectError<ColorName>('bgHotpink');