Interfaces
builder.prismaInterface
works just like builder.prismaObject and can be used to define either the
primary type or a variant for a model.
The following example creates a User
interface, and 2 variants Admin and Member. The resolveType
method returns the typenames as strings to avoid issues with circular references.
When using select mode, it's recommended to add selections to both the interface and the object types that implement them. Selections are not inherited and will fallback to the default selection which includes all scalar columns.
You will not be able to extend an interface for a different prisma model, doing so will result in an error at build time.