Add types to string-width

This commit is contained in:
jacobbubu
2018-05-30 10:18:34 +08:00
parent 348d75dac9
commit 6c10f1278d
4 changed files with 30 additions and 0 deletions

9
types/string-width/index.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
// Type definitions for string-width 2.0
// Project: https://github.com/sindresorhus/string-width
// Definitions by: Rong Shen <https://github.com/jacobbubu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare function stringWidth(text: string): number;
export = stringWidth;

View File

@@ -0,0 +1,4 @@
import stringWidth = require("string-width");
stringWidth("古");
// => 2

View File

@@ -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"]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }