From e928280ea764e50f5100f62efd1062fe10505dbc Mon Sep 17 00:00:00 2001 From: mitchellhamilton Date: Thu, 15 Sep 2022 15:58:19 +1000 Subject: [PATCH] Remove id from resolvedData types --- packages/core/src/lib/schema-type-printer.tsx | 2 +- .../src/scripts/tests/__snapshots__/artifacts.test.ts.snap | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/src/lib/schema-type-printer.tsx b/packages/core/src/lib/schema-type-printer.tsx index dbcd7369ba1..5556701b7fe 100644 --- a/packages/core/src/lib/schema-type-printer.tsx +++ b/packages/core/src/lib/schema-type-printer.tsx @@ -131,7 +131,7 @@ function printInterimType( return [ `type Resolved${typename} = {`, ...Object.entries(list.fields).map(([fieldKey, { dbField }]) => { - if (dbField.kind === 'none') return ` ${fieldKey}?: undefined\n`; + if (dbField.kind === 'none' || fieldKey === 'id') return ` ${fieldKey}?: undefined;`; if (dbField.kind === 'multi') { return printInterimMultiFieldType({ listKey, diff --git a/packages/core/src/scripts/tests/__snapshots__/artifacts.test.ts.snap b/packages/core/src/scripts/tests/__snapshots__/artifacts.test.ts.snap index 708c2d7651e..6339a157362 100644 --- a/packages/core/src/scripts/tests/__snapshots__/artifacts.test.ts.snap +++ b/packages/core/src/scripts/tests/__snapshots__/artifacts.test.ts.snap @@ -107,12 +107,12 @@ export type KeystoneAdminUISortDirection = | "DESC"; type ResolvedTodoCreateInput = { - id?: import('.prisma/client').Prisma.TodoCreateInput["id"]; + id?: undefined; title?: import('.prisma/client').Prisma.TodoCreateInput["title"]; }; type ResolvedTodoUpdateInput = { - id?: import('.prisma/client').Prisma.TodoUpdateInput["id"]; + id?: undefined; title?: import('.prisma/client').Prisma.TodoUpdateInput["title"]; };