diff --git a/types/chance/chance-tests.ts b/types/chance/chance-tests.ts index a52e719fd9..f00bed253a 100644 --- a/types/chance/chance-tests.ts +++ b/types/chance/chance-tests.ts @@ -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]; diff --git a/types/chance/index.d.ts b/types/chance/index.d.ts index 498af7505a..39c18eb47d 100644 --- a/types/chance/index.d.ts +++ b/types/chance/index.d.ts @@ -166,13 +166,15 @@ declare namespace Chance { d100(): number; guid(options?: { version: 4 | 5 }): string; hash(opts?: Options): string; - n(generator: () => T, count: number, opts?: Options): T[]; + n(generator: () => T, count: number): T[]; + n(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(generator: () => T, count: number, opts?: Options): T[]; + unique(generator: () => T, count: number): T[]; + unique(generator: (options: O) => T, count: number, options: O): T[]; weighted(values: T[], weights: number[]): T; // "Hidden"