diff --git a/types/uuidv4/index.d.ts b/types/uuidv4/index.d.ts new file mode 100644 index 0000000000..44f8fc4efe --- /dev/null +++ b/types/uuidv4/index.d.ts @@ -0,0 +1,18 @@ +// Type definitions for uuidv4 2.0 +// Project: https://github.com/thenativeweb/uuidv4#readme +// Definitions by: Rindo Hinase +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = uuidv4; + +declare function uuidv4(): string; + +declare namespace uuidv4 { + type EmptyUUIDv4 = '00000000-0000-0000-0000-000000000000'; + + function is(value: string): boolean; + + function empty(): string; + + function fromString(text: string): string; +} diff --git a/types/uuidv4/tsconfig.json b/types/uuidv4/tsconfig.json new file mode 100644 index 0000000000..4ae973d9cb --- /dev/null +++ b/types/uuidv4/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "strictFunctionTypes": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "uuidv4-tests.ts" + ] +} diff --git a/types/uuidv4/tslint.json b/types/uuidv4/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/uuidv4/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/uuidv4/uuidv4-tests.ts b/types/uuidv4/uuidv4-tests.ts new file mode 100644 index 0000000000..0c5f915d95 --- /dev/null +++ b/types/uuidv4/uuidv4-tests.ts @@ -0,0 +1,13 @@ +import * as uuidv4 from 'uuidv4'; // uuidv4 is () => string + +// $ExpectType string +uuidv4(); + +// $ExpectType string +uuidv4.empty(); + +// $ExpectType boolean +uuidv4.is('00000000-0000-0000-0000-000000000000'); + +// $ExpectType string +uuidv4.fromString("test");