diff --git a/types/shuffle-seed/index.d.ts b/types/shuffle-seed/index.d.ts new file mode 100644 index 0000000000..a2559d0eea --- /dev/null +++ b/types/shuffle-seed/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for shuffle-seed 1.1 +// Project: https://github.com/webcaetano/shuffle-seed#readme +// Definitions by: Leonardo Donelli +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export as namespace shuffleSeed; + +export function shuffle(arr: ReadonlyArray, seed: any): T[]; +export function unshuffle(arr: ReadonlyArray, seed: any): T[]; diff --git a/types/shuffle-seed/shuffle-seed-tests.ts b/types/shuffle-seed/shuffle-seed-tests.ts new file mode 100644 index 0000000000..d8d1e4d8d4 --- /dev/null +++ b/types/shuffle-seed/shuffle-seed-tests.ts @@ -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 diff --git a/types/shuffle-seed/tsconfig.json b/types/shuffle-seed/tsconfig.json new file mode 100644 index 0000000000..8e2a81c6c5 --- /dev/null +++ b/types/shuffle-seed/tsconfig.json @@ -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" + ] +} diff --git a/types/shuffle-seed/tslint.json b/types/shuffle-seed/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/shuffle-seed/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }