Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enhance createList signature #335

Merged
merged 2 commits into from
Jun 19, 2024
Merged

feat: Enhance createList signature #335

merged 2 commits into from
Jun 19, 2024

Conversation

Quramy
Copy link
Owner

@Quramy Quramy commented Jun 19, 2024

What

Allow createList (or buildList) to accept 2nd argument as template of list item:

// Create 3 User model records whose `name` is "Bob"
await UserFactory.createList(3, { name: "Bob" });
// Before
interface UserFactory {
  createList(input: numer | readonly Partial<prisma.UserCreateInput>[]): PromiseLike<User[]>;
}

// After
interface UserFactory {
  createList(count: numer, item?: Partial<prisma.UserCreateInput>): PromiseLike<User[]>;
  createList(list: readonly Partial<prisma.UserCreateInput>[]): PromiseLike<User[]>;
}

@Quramy Quramy changed the base branch from main to next June 19, 2024 08:20
@Quramy Quramy changed the title feature/enhance list sig feat: Enhance createList signature Jun 19, 2024
@Quramy Quramy merged commit 47333b8 into next Jun 19, 2024
1 check passed
@Quramy Quramy deleted the feature/enhance_list_sig branch June 19, 2024 08:38
@Quramy Quramy mentioned this pull request Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant