mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Add shuffle-seed typings (#29798)
* Add shuffle-seed typings * Add strictFunctionTypes tsconfig param, fix linter errors * Improve shuffle-seed type definition, use generics
This commit is contained in:
committed by
Sheetal Nandi
parent
6a8e7c47a1
commit
53af59d83f
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// Type definitions for shuffle-seed 1.1
|
||||
// Project: https://github.com/webcaetano/shuffle-seed#readme
|
||||
// Definitions by: Leonardo Donelli <https://github.com/LeartS>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export as namespace shuffleSeed;
|
||||
|
||||
export function shuffle<T>(arr: ReadonlyArray<T>, seed: any): T[];
|
||||
export function unshuffle<T>(arr: ReadonlyArray<T>, seed: any): T[];
|
||||
@@ -0,0 +1,8 @@
|
||||
import { shuffle, unshuffle } from "shuffle-seed";
|
||||
|
||||
const originalArray = [1, "hello world", 132.81];
|
||||
const shuffled1 = shuffle(originalArray, "randomseed");
|
||||
const shuffled2 = shuffle(originalArray, "randomseed");
|
||||
const unshuffled = unshuffle(shuffled2, "randomseed");
|
||||
// shuffled1 === shuffled2
|
||||
// unshuffled === originalArray
|
||||
@@ -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",
|
||||
"shuffle-seed-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user