mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-13 05:20:25 +00:00
Merge pull request #11348 from geoffreak/uid-safe-typing
Typing for uid-safe [Types 2.0]
This commit is contained in:
Vendored
+18
@@ -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;
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -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);
|
||||
Reference in New Issue
Block a user