Merge pull request #11348 from geoffreak/uid-safe-typing

Typing for uid-safe [Types 2.0]
This commit is contained in:
Andy
2016-09-20 11:03:30 -07:00
committed by GitHub
3 changed files with 49 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
// Type definitions for uid-safe v2.1
// Project: https://github.com/crypto-utils/uid-safe
// Definitions by: Joshua DeVinney <https://github.com/geoffreak>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace UID {
export interface Generate {
(byteLength: number, callback: (err: any, str: string) => any): void;
(byteLength: number): Promise<any>;
sync(byteLength: number): string;
}
}
declare var UID: UID.Generate;
export = UID;
+19
View File
@@ -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"
]
}
+12
View File
@@ -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);