feat: Add typings for math-random (#42082)

* feat: Add typings for math-random

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* fix: `cryptographic` should be true | undefined

Signed-off-by: Richie Bendall <richiebendall@gmail.com>
This commit is contained in:
Richie Bendall 2020-02-06 07:51:24 +13:00 committed by GitHub
parent 0c432c26d5
commit d05a9de5c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 0 deletions

11
types/math-random/index.d.ts vendored Normal file
View File

@ -0,0 +1,11 @@
// Type definitions for math-random 1.0
// Project: https://github.com/michaelrhodes/math-random#readme
// Definitions by: Richie Bendall <https://github.com/Richienb>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare const mathRandom: {
(): number;
cryptographic: true | undefined;
};
export = mathRandom;

View File

@ -0,0 +1,4 @@
import mathRandom = require("math-random");
mathRandom(); // $ExpectType number
mathRandom.cryptographic; // $ExpectType true | undefined

View File

@ -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"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }