mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
return list of type for Factory.buildList (#46623)
This commit is contained in:
parent
8340511f34
commit
4c0f56b8da
2
types/rosie/index.d.ts
vendored
2
types/rosie/index.d.ts
vendored
@ -39,7 +39,7 @@ declare namespace rosie {
|
||||
* @param {object=} options
|
||||
* @return {Array.<*>}
|
||||
*/
|
||||
buildList(name: string, size: number, attributes?: any, options?: any): any[];
|
||||
buildList<T>(name: string, size: number, attributes?: { [k in keyof T]?: T[k] | boolean }, options?: any): T[];
|
||||
|
||||
/**
|
||||
* Locates a factory by name and calls #attributes on it.
|
||||
|
||||
@ -44,6 +44,8 @@ interface Person {
|
||||
}
|
||||
|
||||
const personFactory = Factory.define<Person>('Person').attr('firstName', 'John').sequence('id');
|
||||
// building a list with a type definition returns that type
|
||||
Factory.buildList<Person>('Person', 420, { age: 69 })
|
||||
|
||||
// Building does not require the first (attributes) and second (options) arguments
|
||||
personFactory.build();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user