Open skworden opened 2 years ago
I'd like a way to pass our own defaultOptions type for PrismaSelect defaultOptions.
defaultOptions
The select function is any, and the object keys are generic string.
any
string
For reference, here's an example that is fully typed for nexus autogenerated types. Nexus autogenerated types are dynamic nested objects.
import { NexusGenFieldTypes } from "/my/nexus-types.generated"; // Can be the current default option type AllowedNexusTypes = Partial< Omit<NexusGenFieldTypes, "Mutation" | "Query"> >; type DefaultFields<T = AllowedNexusTypes> = Required<{ [K in keyof T]: | Partial<{ [P in keyof Required<T>[K]]: boolean }> | ((select: Required<T>[K]) => Record<string, boolean>); }>; const defaultFields: TDefaultFields = { Category: { id: true }, // key and options are typed Page: (select) => ({ // key, options, and select are typed id: true, categoryId: !!select.category, }), Tag: { id: true }, }
I'd like a way to pass our own
defaultOptions
type for PrismaSelectdefaultOptions
.The select function is
any
, and the object keys are genericstring
.For reference, here's an example that is fully typed for nexus autogenerated types. Nexus autogenerated types are dynamic nested objects.