From b0f800cc8134b37ed5c176d3fc80f63706d9e3f6 Mon Sep 17 00:00:00 2001 From: Bartosz Dotryw Date: Sun, 4 Nov 2018 23:13:01 +0100 Subject: [PATCH 1/3] New types for react-native-uuid-generator --- types/react-native-uuid-generator/index.d.ts | 9 ++++++++ .../react-native-uuid-generator-tests.ts | 5 +++++ .../react-native-uuid-generator/tsconfig.json | 22 +++++++++++++++++++ types/react-native-uuid-generator/tslint.json | 1 + 4 files changed, 37 insertions(+) create mode 100644 types/react-native-uuid-generator/index.d.ts create mode 100644 types/react-native-uuid-generator/react-native-uuid-generator-tests.ts create mode 100644 types/react-native-uuid-generator/tsconfig.json create mode 100644 types/react-native-uuid-generator/tslint.json diff --git a/types/react-native-uuid-generator/index.d.ts b/types/react-native-uuid-generator/index.d.ts new file mode 100644 index 0000000000..a884354e35 --- /dev/null +++ b/types/react-native-uuid-generator/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for react-native-uuid-generator 4.0 +// Project: https://github.com/Traviskn/react-native-uuid-generator#readme +// Definitions by: Bartosz Dotryw +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export default class UUIDGenerator { + static getRandomUUID(): Promise; + static getRandomUUID(callback: (uuid: string) => void): void; +} diff --git a/types/react-native-uuid-generator/react-native-uuid-generator-tests.ts b/types/react-native-uuid-generator/react-native-uuid-generator-tests.ts new file mode 100644 index 0000000000..b65f0ef410 --- /dev/null +++ b/types/react-native-uuid-generator/react-native-uuid-generator-tests.ts @@ -0,0 +1,5 @@ +import UUIDGenerator from 'react-native-uuid-generator'; + +UUIDGenerator.getRandomUUID().then((uuid: string) => { }).catch((error: any) => { }); + +UUIDGenerator.getRandomUUID((uuid: string) => { }); diff --git a/types/react-native-uuid-generator/tsconfig.json b/types/react-native-uuid-generator/tsconfig.json new file mode 100644 index 0000000000..777701c42e --- /dev/null +++ b/types/react-native-uuid-generator/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-native-uuid-generator-tests.ts" + ] +} diff --git a/types/react-native-uuid-generator/tslint.json b/types/react-native-uuid-generator/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-uuid-generator/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 3da08ff68f738332ec59ff8b0d71e63328c6c963 Mon Sep 17 00:00:00 2001 From: Bartosz Dotryw Date: Sun, 4 Nov 2018 23:51:51 +0100 Subject: [PATCH 2/3] Linted --- types/react-native-uuid-generator/index.d.ts | 8 +++++--- types/react-native-uuid-generator/tsconfig.json | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/types/react-native-uuid-generator/index.d.ts b/types/react-native-uuid-generator/index.d.ts index a884354e35..6014c9dc17 100644 --- a/types/react-native-uuid-generator/index.d.ts +++ b/types/react-native-uuid-generator/index.d.ts @@ -3,7 +3,9 @@ // Definitions by: Bartosz Dotryw // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export default class UUIDGenerator { - static getRandomUUID(): Promise; - static getRandomUUID(callback: (uuid: string) => void): void; +declare namespace UUIDGenerator { + function getRandomUUID(): Promise; + function getRandomUUID(callback: (uuid: string) => void): void; } + +export default UUIDGenerator; diff --git a/types/react-native-uuid-generator/tsconfig.json b/types/react-native-uuid-generator/tsconfig.json index 777701c42e..30c1f52249 100644 --- a/types/react-native-uuid-generator/tsconfig.json +++ b/types/react-native-uuid-generator/tsconfig.json @@ -7,6 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 31ad9b4fa2fdc0b47df683a7ed4c730ccb2e8a60 Mon Sep 17 00:00:00 2001 From: Bartosz Dotryw Date: Sun, 4 Nov 2018 23:58:47 +0100 Subject: [PATCH 3/3] Changed author's name --- types/react-native-uuid-generator/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native-uuid-generator/index.d.ts b/types/react-native-uuid-generator/index.d.ts index 6014c9dc17..ad5cb96bec 100644 --- a/types/react-native-uuid-generator/index.d.ts +++ b/types/react-native-uuid-generator/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-native-uuid-generator 4.0 // Project: https://github.com/Traviskn/react-native-uuid-generator#readme -// Definitions by: Bartosz Dotryw +// Definitions by: burtek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace UUIDGenerator {