diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..3231d6e --- /dev/null +++ b/index.d.ts @@ -0,0 +1,31 @@ +export type Format = (string: string) => string; + +export const reset: Format; +export const bold: Format; +export const dim: Format; +export const italic: Format; +export const underline: Format; +export const overline: Format; +export const inverse: Format; +export const hidden: Format; +export const strikethrough: Format; + +export const black: Format; +export const red: Format; +export const green: Format; +export const yellow: Format; +export const blue: Format; +export const magenta: Format; +export const cyan: Format; +export const white: Format; +export const gray: Format; + +export const bgBlack: Format; +export const bgRed: Format; +export const bgGreen: Format; +export const bgYellow: Format; +export const bgBlue: Format; +export const bgMagenta: Format; +export const bgCyan: Format; +export const bgWhite: Format; +export const bgGray: Format; diff --git a/index.test-d.ts b/index.test-d.ts new file mode 100644 index 0000000..d9c9a57 --- /dev/null +++ b/index.test-d.ts @@ -0,0 +1,4 @@ +import {expectType} from 'tsd'; +import * as colors from './index.js'; + +expectType(colors.red('x')); diff --git a/package.json b/package.json index 25f7a53..d6cf79e 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "scripts": { - "test": "xo && ava" + "test": "xo && ava && tsd" }, "files": [ "index.js", @@ -44,6 +44,7 @@ ], "devDependencies": { "ava": "^3.15.0", + "tsd": "^0.17.0", "xo": "^0.44.0" } }