From 6c10f1278dd6f8c1962cf5aff6c545b7e990958c Mon Sep 17 00:00:00 2001 From: jacobbubu Date: Wed, 30 May 2018 10:18:34 +0800 Subject: [PATCH] Add types to string-width --- types/string-width/index.d.ts | 9 +++++++++ types/string-width/string-width-tests.ts | 4 ++++ types/string-width/tsconfig.json | 16 ++++++++++++++++ types/string-width/tslint.json | 1 + 4 files changed, 30 insertions(+) create mode 100644 types/string-width/index.d.ts create mode 100644 types/string-width/string-width-tests.ts create mode 100644 types/string-width/tsconfig.json create mode 100644 types/string-width/tslint.json 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" }