From 371bffbf56ea185a8699bc44b4e79dda22555f74 Mon Sep 17 00:00:00 2001 From: Roberts Slisans Date: Wed, 9 Aug 2017 20:31:00 +0300 Subject: [PATCH] Added uniqid definition (#18780) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Created definitions & tests for pick-weight 🎲 * Fix no-single-module * Added uniqid definition --- types/uniqid/index.d.ts | 13 +++++++++++++ types/uniqid/tsconfig.json | 22 ++++++++++++++++++++++ types/uniqid/tslint.json | 1 + types/uniqid/uniqid-tests.ts | 7 +++++++ 4 files changed, 43 insertions(+) create mode 100644 types/uniqid/index.d.ts create mode 100644 types/uniqid/tsconfig.json create mode 100644 types/uniqid/tslint.json create mode 100644 types/uniqid/uniqid-tests.ts diff --git a/types/uniqid/index.d.ts b/types/uniqid/index.d.ts new file mode 100644 index 0000000000..e3853a64a3 --- /dev/null +++ b/types/uniqid/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for uniqid 4.1 +// Project: http://github.com/adamhalasz/diet-uniqid/ +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// Commmon function signature +declare function f(prefix: string): string; + +// let x -> Workaround for ES6 imports +// Combined type because of assigning to function object in original module +declare let x: typeof f & { process: typeof f } & { time: typeof f }; + +export = x; diff --git a/types/uniqid/tsconfig.json b/types/uniqid/tsconfig.json new file mode 100644 index 0000000000..437a215958 --- /dev/null +++ b/types/uniqid/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", + "uniqid-tests.ts" + ] +} diff --git a/types/uniqid/tslint.json b/types/uniqid/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/uniqid/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/uniqid/uniqid-tests.ts b/types/uniqid/uniqid-tests.ts new file mode 100644 index 0000000000..f0f56aa2fd --- /dev/null +++ b/types/uniqid/uniqid-tests.ts @@ -0,0 +1,7 @@ +import * as uniqid from "uniqid"; + +const uniqueID = uniqid("123"); +const processString = uniqid.process("123"); +const timeString = uniqid.time("123"); + +if (uniqueID === "" && processString === "" && timeString === "") { /**/ }