Add types for unique-random-array

This commit is contained in:
Dimitri Benin
2018-12-03 00:26:33 +01:00
parent efbcbdebaf
commit ccce0edf6d
4 changed files with 38 additions and 0 deletions

8
types/unique-random-array/index.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
// Type definitions for unique-random-array 1.0
// Project: https://github.com/sindresorhus/unique-random-array#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = uniqueRandomArray;
declare function uniqueRandomArray<T>(input: T[]): () => T;

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"unique-random-array-tests.ts"
]
}

View File

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

View File

@@ -0,0 +1,6 @@
import uniqueRandomArray = require('unique-random-array');
// $ExpectType () => number
uniqueRandomArray([1, 2, 3, 4]);
// $ExpectType () => string | number
uniqueRandomArray(["1", 2, 3, 4]);