From 4c0f56b8da511c2c87db442c9b3daf34112fdcac Mon Sep 17 00:00:00 2001 From: Tristan Siegel Date: Tue, 8 Sep 2020 07:42:13 -0400 Subject: [PATCH] return list of type for Factory.buildList (#46623) --- types/rosie/index.d.ts | 2 +- types/rosie/rosie-tests.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/rosie/index.d.ts b/types/rosie/index.d.ts index 03262bbeb1..a6de6657ce 100644 --- a/types/rosie/index.d.ts +++ b/types/rosie/index.d.ts @@ -39,7 +39,7 @@ declare namespace rosie { * @param {object=} options * @return {Array.<*>} */ - buildList(name: string, size: number, attributes?: any, options?: any): any[]; + buildList(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. diff --git a/types/rosie/rosie-tests.ts b/types/rosie/rosie-tests.ts index b50598de3f..ed53b76850 100644 --- a/types/rosie/rosie-tests.ts +++ b/types/rosie/rosie-tests.ts @@ -44,6 +44,8 @@ interface Person { } const personFactory = Factory.define('Person').attr('firstName', 'John').sequence('id'); +// building a list with a type definition returns that type +Factory.buildList('Person', 420, { age: 69 }) // Building does not require the first (attributes) and second (options) arguments personFactory.build();