diff --git a/types/wcwidth/index.d.ts b/types/wcwidth/index.d.ts new file mode 100644 index 0000000000..da9920a611 --- /dev/null +++ b/types/wcwidth/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for wcwidth 1.0 +// Project: https://github.com/timoxley/wcwidth +// Definitions by: Junyoung Choi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function wcwidth(input: string): number; + +export = wcwidth; diff --git a/types/wcwidth/tsconfig.json b/types/wcwidth/tsconfig.json new file mode 100644 index 0000000000..55ce5efd5b --- /dev/null +++ b/types/wcwidth/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "wcwidth-tests.ts" + ] +} diff --git a/types/wcwidth/tslint.json b/types/wcwidth/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/wcwidth/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/wcwidth/wcwidth-tests.ts b/types/wcwidth/wcwidth-tests.ts new file mode 100644 index 0000000000..11f150a73c --- /dev/null +++ b/types/wcwidth/wcwidth-tests.ts @@ -0,0 +1,5 @@ +import wcwidth = require('wcwidth'); + +const length1 = wcwidth('ν•œ'); // => 2 + +const length2 = wcwidth('ν•œκΈ€'); // => 4