mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
correctly support options with Chance#n method (#38711)
* correctly support options with Chance#n method * correctly support options with Chance#unique method * correctly support options with Chance#unique method
This commit is contained in:
committed by
Ryan Cavanaugh
parent
ea511606c9
commit
45780f09bd
@@ -15,8 +15,10 @@ guid = chance.guid({ version: 4 });
|
||||
guid = chance.guid({ version: 5 });
|
||||
|
||||
const strArr: string[] = chance.n(chance.string, 42);
|
||||
const strArr2: string[] = chance.n((a) => a.value, 42, { value: 'test' });
|
||||
|
||||
const uniqInts: number[] = chance.unique(chance.integer, 99);
|
||||
const uniqInts2: number[] = chance.unique(a => a.value, 99, { value: 1 });
|
||||
|
||||
const currencyPair = chance.currency_pair();
|
||||
const firstCurrency = currencyPair[0];
|
||||
|
||||
6
types/chance/index.d.ts
vendored
6
types/chance/index.d.ts
vendored
@@ -166,13 +166,15 @@ declare namespace Chance {
|
||||
d100(): number;
|
||||
guid(options?: { version: 4 | 5 }): string;
|
||||
hash(opts?: Options): string;
|
||||
n<T>(generator: () => T, count: number, opts?: Options): T[];
|
||||
n<T>(generator: () => T, count: number): T[];
|
||||
n<T, O extends Options>(generator: (options: O) => T, count: number, options: O): T[];
|
||||
normal(opts?: Options): number;
|
||||
radio(opts?: Options): string;
|
||||
rpg(dice: string): number[];
|
||||
rpg(dice: string, opts?: Options): number[] | number;
|
||||
tv(opts?: Options): string;
|
||||
unique<T>(generator: () => T, count: number, opts?: Options): T[];
|
||||
unique<T>(generator: () => T, count: number): T[];
|
||||
unique<T, O extends Options>(generator: (options: O) => T, count: number, options: O): T[];
|
||||
weighted<T>(values: T[], weights: number[]): T;
|
||||
|
||||
// "Hidden"
|
||||
|
||||
Reference in New Issue
Block a user