diff --git a/types/punycode/index.d.ts b/types/punycode/index.d.ts new file mode 100644 index 0000000000..a3048a5e28 --- /dev/null +++ b/types/punycode/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for punycode 2.1 +// Project: https://mths.be/punycode +// Definitions by: Dmitry Guketlev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function decode(input: string): string; +export function encode(input: string): string; +export function toUnicode(input: string): string; +export function toASCII(input: string): string; + +export namespace ucs2 { + function decode(string: string): number[]; + function encode(array: ReadonlyArray): string; +} + +export const version: string; diff --git a/types/punycode/punycode-tests.ts b/types/punycode/punycode-tests.ts new file mode 100644 index 0000000000..4de954fbc7 --- /dev/null +++ b/types/punycode/punycode-tests.ts @@ -0,0 +1,11 @@ +import punycode = require('punycode'); + +const result1: string = punycode.decode('x'); +const result2: string = punycode.encode('x'); +const result3: string = punycode.toASCII('x'); +const result4: string = punycode.toUnicode('x'); + +const ucs2result1: number[] = punycode.ucs2.decode('x'); +const ucs2result2: string = punycode.ucs2.encode([1, 2, 3]); + +const version: string = punycode.version; diff --git a/types/punycode/tsconfig.json b/types/punycode/tsconfig.json new file mode 100644 index 0000000000..0474c0a874 --- /dev/null +++ b/types/punycode/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "punycode-tests.ts" + ] +} diff --git a/types/punycode/tslint.json b/types/punycode/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/punycode/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }