diff --git a/types/string-width/index.d.ts b/types/string-width/index.d.ts new file mode 100644 index 0000000000..d896fe3c79 --- /dev/null +++ b/types/string-width/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for string-width 2.0 +// Project: https://github.com/sindresorhus/string-width +// Definitions by: Rong Shen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare function stringWidth(text: string): number; +export = stringWidth; diff --git a/types/string-width/string-width-tests.ts b/types/string-width/string-width-tests.ts new file mode 100644 index 0000000000..f48fb647af --- /dev/null +++ b/types/string-width/string-width-tests.ts @@ -0,0 +1,4 @@ +import stringWidth = require("string-width"); + +stringWidth("古"); +// => 2 diff --git a/types/string-width/tsconfig.json b/types/string-width/tsconfig.json new file mode 100644 index 0000000000..bc216bafd3 --- /dev/null +++ b/types/string-width/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "string-width-tests.ts"] +} diff --git a/types/string-width/tslint.json b/types/string-width/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/string-width/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }