diff --git a/uid-safe/index.d.ts b/uid-safe/index.d.ts new file mode 100644 index 0000000000..ee7b13491f --- /dev/null +++ b/uid-safe/index.d.ts @@ -0,0 +1,18 @@ +// Type definitions for uid-safe v2.1 +// Project: https://github.com/crypto-utils/uid-safe +// Definitions by: Joshua DeVinney +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace UID { + + export interface Generate { + + (byteLength: number, callback: (err: any, str: string) => any): void; + (byteLength: number): Promise; + + sync(byteLength: number): string; + } +} + +declare var UID: UID.Generate; +export = UID; diff --git a/uid-safe/tsconfig.json b/uid-safe/tsconfig.json new file mode 100644 index 0000000000..5c29fae11c --- /dev/null +++ b/uid-safe/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "uid-safe-tests.ts" + ] +} \ No newline at end of file diff --git a/uid-safe/uid-safe-tests.ts b/uid-safe/uid-safe-tests.ts new file mode 100644 index 0000000000..6af969ce60 --- /dev/null +++ b/uid-safe/uid-safe-tests.ts @@ -0,0 +1,12 @@ +import * as uid from 'uid-safe'; + +uid(18, function (err, string) { + if (err) throw err + // do something with the string +}); + +uid(18).then(function (string) { + // do something with the string +}) + +var string = uid.sync(18);