diff --git a/types/random-normal/index.d.ts b/types/random-normal/index.d.ts new file mode 100644 index 0000000000..a0f0ebc87c --- /dev/null +++ b/types/random-normal/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for random-normal 1.0 +// Project: https://github.com/mock-end/random-normal +// Definitions by: Darius I. Karel +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Normal distribution options + */ +interface Options { + /** The mean of the normal distribution. Defaults to 0 */ + mean?: number; + + /** The standard deviation of the normal distribution. Defaults to 1 */ + dev?: number; +} + +/** + * Return a [normally-distributed](https://en.wikipedia.org/wiki/Normal_distribution) + * random number. By default this, starts with a mean of 0 and a standard + * deviation of 1 which is the standard normal distribution. + * @param options Controls the shape of the normal distribution + */ +declare function randomNormal(options?: Options): number; + +export = randomNormal; diff --git a/types/random-normal/random-normal-tests.ts b/types/random-normal/random-normal-tests.ts new file mode 100644 index 0000000000..fdff2756e7 --- /dev/null +++ b/types/random-normal/random-normal-tests.ts @@ -0,0 +1,11 @@ +import randomNormal = require('random-normal'); + +// No options specified +randomNormal(); // $ExpectType number + +// All options specified +randomNormal({ mean: 5, dev: 7 }); // $ExpectType number + +// Partial options specified +randomNormal({ dev: 7 }); // $ExpectType number +randomNormal({ mean: 5 }); // $ExpectType number diff --git a/types/random-normal/tsconfig.json b/types/random-normal/tsconfig.json new file mode 100644 index 0000000000..bfa2db60bf --- /dev/null +++ b/types/random-normal/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", + "random-normal-tests.ts" + ] +} diff --git a/types/random-normal/tslint.json b/types/random-normal/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/random-normal/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }