Added test for Typescript definition
This commit is contained in:
parent
3cd849197d
commit
f18decbd7f
4 changed files with 43 additions and 2 deletions
|
|
@ -8,7 +8,7 @@
|
||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "xo && nyc mocha",
|
"test": "xo && tsc -p types && nyc mocha",
|
||||||
"bench": "matcha benchmark.js",
|
"bench": "matcha benchmark.js",
|
||||||
"coveralls": "nyc report --reporter=text-lcov | coveralls"
|
"coveralls": "nyc report --reporter=text-lcov | coveralls"
|
||||||
},
|
},
|
||||||
|
|
@ -51,9 +51,10 @@
|
||||||
"mocha": "*",
|
"mocha": "*",
|
||||||
"nyc": "^11.0.2",
|
"nyc": "^11.0.2",
|
||||||
"resolve-from": "^3.0.0",
|
"resolve-from": "^3.0.0",
|
||||||
|
"typescript": "^2.4.1",
|
||||||
"xo": "*"
|
"xo": "*"
|
||||||
},
|
},
|
||||||
"types": "./index.d.ts",
|
"types": "./types/index.d.ts",
|
||||||
"xo": {
|
"xo": {
|
||||||
"envs": [
|
"envs": [
|
||||||
"node",
|
"node",
|
||||||
|
|
|
||||||
0
index.d.ts → types/index.d.ts
vendored
0
index.d.ts → types/index.d.ts
vendored
31
types/test.ts
Normal file
31
types/test.ts
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
import * as chalk from '../.';
|
||||||
|
|
||||||
|
chalk.underline('foo');
|
||||||
|
chalk.red('foo');
|
||||||
|
chalk.bgRed('foo');
|
||||||
|
|
||||||
|
chalk.red`foo`;
|
||||||
|
chalk.underline`foo`;
|
||||||
|
chalk`foo`;
|
||||||
|
|
||||||
|
chalk.red.bgGreen.underline('foo');
|
||||||
|
chalk.underline.red.bgGreen('foo');
|
||||||
|
|
||||||
|
chalk.grey('foo');
|
||||||
|
chalk.red(0);
|
||||||
|
|
||||||
|
const ctx = chalk.constructor({level: 1});
|
||||||
|
ctx('foo');
|
||||||
|
ctx.red('foo');
|
||||||
|
ctx`foo`;
|
||||||
|
|
||||||
|
chalk.enabled;
|
||||||
|
chalk.supportsColor;
|
||||||
|
chalk.level;
|
||||||
|
|
||||||
|
chalk.keyword('orange').bgBlue('foo');
|
||||||
|
chalk.hex('#123456').bgBlue('foo');
|
||||||
|
chalk.rgb(1, 14, 9).bgBlue('foo');
|
||||||
|
chalk.hsl(1, 14, 9).bgBlue('foo');
|
||||||
|
chalk.hsv(1, 14, 9).bgBlue('foo');
|
||||||
|
chalk.hwb(1, 14, 9).bgBlue('foo');
|
||||||
9
types/tsconfig.json
Normal file
9
types/tsconfig.json
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "commonjs",
|
||||||
|
"target": "es6",
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"allowJs": true
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue