mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
fast-shuffle: returns type based on argument (#38544)
This commit is contained in:
parent
8238de91cf
commit
35362243fe
@ -2,8 +2,8 @@ import shuffle from 'fast-shuffle';
|
||||
|
||||
{
|
||||
const d1 = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'];
|
||||
const d2 = shuffle(d1);
|
||||
const d3 = shuffle(d1, () => 0.42);
|
||||
const d2: string[] = shuffle(d1);
|
||||
const d3: string[] = shuffle(d1, () => 0.42);
|
||||
}
|
||||
|
||||
{
|
||||
@ -12,6 +12,6 @@ import shuffle from 'fast-shuffle';
|
||||
{ name: 'Betty', money: 20 },
|
||||
{ name: 'Cindy', money: 15 }
|
||||
];
|
||||
const d2 = shuffle(d1);
|
||||
const d3 = shuffle(d1, () => 0.42);
|
||||
const d2: Array<{ name: string, money: number }> = shuffle(d1);
|
||||
const d3: Array<{ name: string, money: number }> = shuffle(d1, () => 0.42);
|
||||
}
|
||||
|
||||
2
types/fast-shuffle/index.d.ts
vendored
2
types/fast-shuffle/index.d.ts
vendored
@ -3,4 +3,4 @@
|
||||
// Definitions by: Piotr Roszatycki <https://github.com/dex4er>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export default function shuffle(deck: ReadonlyArray<any>, random?: () => number): any[];
|
||||
export default function shuffle<T>(deck: ReadonlyArray<T>, random?: () => number): T[];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user