Skip to content

Rename the build method #900

@jackfranklin

Description

@jackfranklin

It's confusing that you call build() to create a builder, but then when we talk about creating instances, we also talk about building them.

I just hit this when working on #899, where at one point we considered an API of:

const userBuilder = build<User>(...);

const users = buildMany(userBuilder, 20)

This isn't the final API we landed on, but it's confusing that build here means different things: in the first instance we build a builder and in the second we build many instances of the builder.

If we were to rename build to something else, such as:

  • createBuilder
  • construct
  • (ideas welcome!)

Then this would make it easier to follow, document and understand. This could be done slowly, and we could support build() and whatever the new name is for at least 1 major version (+ ship deprecation message) before eventually removing build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions