mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add typings for npm module uid2 (#36207)
* Add typings for npm module uid2 * Add callback parameter to uid typing * Refactor uid2 typings to different style * Enable dt-header lint rule @types/uid2 * Fix tests
This commit is contained in:
parent
64fc67104c
commit
7619b2d6f5
9
types/uid2/index.d.ts
vendored
Normal file
9
types/uid2/index.d.ts
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
// Type definitions for uid2 0.0
|
||||
// Project: https://github.com/coreh/uid2
|
||||
// Definitions by: Levi Bostian <https://github.com/levibostian>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function uid2(length: number): string;
|
||||
declare function uid2(length: number, callback: (err: Error | null, result?: string) => void): void;
|
||||
|
||||
export = uid2;
|
||||
23
types/uid2/tsconfig.json
Normal file
23
types/uid2/tsconfig.json
Normal file
@ -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",
|
||||
"uid2-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/uid2/tslint.json
Normal file
3
types/uid2/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
8
types/uid2/uid2-tests.ts
Normal file
8
types/uid2/uid2-tests.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import uid2 = require('uid2');
|
||||
|
||||
uid2(20); // $ExpectType string
|
||||
|
||||
uid2(20, (error, result) => {
|
||||
error; // $ExpectType Error | null
|
||||
result; // $ExpectType string | undefined
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user