From d05a9de5c6bd6987dc6c2b6cae98ce56691c6f68 Mon Sep 17 00:00:00 2001 From: Richie Bendall Date: Thu, 6 Feb 2020 07:51:24 +1300 Subject: [PATCH] feat: Add typings for math-random (#42082) * feat: Add typings for math-random Signed-off-by: Richie Bendall * fix: `cryptographic` should be true | undefined Signed-off-by: Richie Bendall --- types/math-random/index.d.ts | 11 +++++++++++ types/math-random/math-random-tests.ts | 4 ++++ types/math-random/tsconfig.json | 23 +++++++++++++++++++++++ types/math-random/tslint.json | 1 + 4 files changed, 39 insertions(+) create mode 100644 types/math-random/index.d.ts create mode 100644 types/math-random/math-random-tests.ts create mode 100644 types/math-random/tsconfig.json create mode 100644 types/math-random/tslint.json diff --git a/types/math-random/index.d.ts b/types/math-random/index.d.ts new file mode 100644 index 0000000000..93e67c2bf9 --- /dev/null +++ b/types/math-random/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for math-random 1.0 +// Project: https://github.com/michaelrhodes/math-random#readme +// Definitions by: Richie Bendall +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare const mathRandom: { + (): number; + cryptographic: true | undefined; +}; + +export = mathRandom; diff --git a/types/math-random/math-random-tests.ts b/types/math-random/math-random-tests.ts new file mode 100644 index 0000000000..9ef613bdbc --- /dev/null +++ b/types/math-random/math-random-tests.ts @@ -0,0 +1,4 @@ +import mathRandom = require("math-random"); + +mathRandom(); // $ExpectType number +mathRandom.cryptographic; // $ExpectType true | undefined diff --git a/types/math-random/tsconfig.json b/types/math-random/tsconfig.json new file mode 100644 index 0000000000..cf5af81818 --- /dev/null +++ b/types/math-random/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "math-random-tests.ts" + ] +} diff --git a/types/math-random/tslint.json b/types/math-random/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/math-random/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }