Hi. I am getting the error below when trying to ru...
# orm-help
d
Hi. I am getting the error below when trying to run
npm build
with an existing very simple database with two tables: node_modules/.prisma/client/index.d.ts144998 - error TS2314: Generic type ‘Keys’ requires 1 type argument(s). I have two tables,
Keys
and
KeyRatios
mapped like this (omitted trivial attributes):
Copy code
model KeyRatios {
  Id                Int       @id(map: “PK_KeyRatios”) @default(autoincrement())
  KeyId             Int
  Keys              Keys      @relation(fields: [KeyId], references: [Id], onDelete: Cascade, onUpdate: NoAction, map: “FK_KeyRatios_Keys_KeyId”)

  @@index([KeyId], map: “IX_KeyRatios_KeyId”)
}

model Keys {
  Id                        Int         @id(map: “PK_Keys”) @default(autoincrement())
  KeyRatios                 KeyRatios[]
}
Copy code
1449     Keys<T extends KeysArgs = {}>(args?: Subset<T, KeysArgs>): CheckSelect<T, Prisma__KeysClient<Keys | null >, Prisma__KeysClient<KeysGetPayload<T> | null >>;
                                                                                                      ~~~~

node_modules/.prisma/client/index.d.ts:2049:11 - error TS2314: Generic type 'Keys' requires 1 type argument(s).

2049         ? Keys
               ~~~~

node_modules/.prisma/client/index.d.ts:2054:7 - error TS2314: Generic type 'Keys' requires 1 type argument(s).

2054     ? Keys  & {
           ~~~~

node_modules/.prisma/client/index.d.ts:2063:51 - error TS2314: Generic type 'Keys' requires 1 type argument(s).

2063     [P in TrueKeys<S['select']>]: P extends keyof Keys ?Keys [P]
                                                       ~~~~

node_modules/.prisma/client/index.d.ts:2063:57 - error TS2314: Generic type 'Keys' requires 1 type argument(s).

2063     [P in TrueKeys<S['select']>]: P extends keyof Keys ?Keys [P]
                                                             ~~~~

node_modules/.prisma/client/index.d.ts:2070:7 - error TS2314: Generic type 'Keys' requires 1 type argument(s).

2070     : Keys
           ~~~~

node_modules/.prisma/client/index.d.ts:2071:5 - error TS2314: Generic type 'Keys' requires 1 type argument(s).

2071   : Keys
         ~~~~

node_modules/.prisma/client/index.d.ts:2094:132 - error TS2314: Generic type 'Keys' requires 1 type argument(s).

2094     ): HasReject<GlobalRejectSettings, LocalRejectSettings, 'findUnique', 'Keys'> extends True ? CheckSelect<T, Prisma__KeysClient<Keys>, Prisma__KeysClient<KeysGetPayload<T>>> : CheckSelect<T, Prisma__KeysClient<Keys | null >, Prisma__KeysClient<KeysGetPayload<T> | null >>
                                                                                                                                        ~~~~

node_modules/.prisma/client/index.d.ts:2094:214 - error TS2314: Generic type 'Keys' requires 1 type argument(s).

2094     ): HasReject<GlobalRejectSettings, LocalRejectSettings, 'findUnique', 'Keys'> extends True ? CheckSelect<T, Prisma__KeysClient<Keys>, Prisma__KeysClient<KeysGetPayload<T>>> : CheckSelect<T, Prisma__KeysClient<Keys | null >, Prisma__KeysClient<KeysGetPayload<T> | null >>
                                                                                                                                                                                                                          ~~~~

node_modules/.prisma/client/index.d.ts:2111:131 - error TS2314: Generic type 'Keys' requires 1 type argument(s).

2111     ): HasReject<GlobalRejectSettings, LocalRejectSettings, 'findFirst', 'Keys'> extends True ? CheckSelect<T, Prisma__KeysClient<Keys>, Prisma__KeysClient<KeysGetPayload<T>>> : CheckSelect<T, Prisma__KeysClient<Keys | null >, Prisma__KeysClient<KeysGetPayload<T> | null >>
                                                                                                                                       ~~~~

node_modules/.prisma/client/index.d.ts:2111:213 - error TS2314: Generic type 'Keys' requires 1 type argument(s).

2111     ): HasReject<GlobalRejectSettings, LocalRejectSettings, 'findFirst', 'Keys'> extends True ? CheckSelect<T, Prisma__KeysClient<Keys>, Prisma__KeysClient<KeysGetPayload<T>>> : CheckSelect<T, Prisma__KeysClient<Keys | null >, Prisma__KeysClient<KeysGetPayload<T> | null >>
                                                                                                                                                                                                                         ~~~~

node_modules/.prisma/client/index.d.ts:2131:43 - error TS2314: Generic type 'Keys' requires 1 type argument(s).

2131     ): CheckSelect<T, PrismaPromise<Array<Keys>>, PrismaPromise<Array<KeysGetPayload<T>>>>
                                               ~~~~

node_modules/.prisma/client/index.d.ts:2147:42 - error TS2314: Generic type 'Keys' requires 1 type argument(s).

2147     ): CheckSelect<T, Prisma__KeysClient<Keys>, Prisma__KeysClient<KeysGetPayload<T>>>
                                              ~~~~

node_modules/.prisma/client/index.d.ts:2179:42 - error TS2314: Generic type 'Keys' requires 1 type argument(s).

2179     ): CheckSelect<T, Prisma__KeysClient<Keys>, Prisma__KeysClient<KeysGetPayload<T>>>
                                              ~~~~

node_modules/.prisma/client/index.d.ts:2198:42 - error TS2314: Generic type 'Keys' requires 1 type argument(s).

2198     ): CheckSelect<T, Prisma__KeysClient<Keys>, Prisma__KeysClient<KeysGetPayload<T>>>
                                              ~~~~

node_modules/.prisma/client/index.d.ts:2256:42 - error TS2314: Generic type 'Keys' requires 1 type argument(s).

2256     ): CheckSelect<T, Prisma__KeysClient<Keys>, Prisma__KeysClient<KeysGetPayload<T>>>
r
@Daniel 👋 Could you change the model name of
Keys
to something else and check?
If that doesn’t work, check if you have the latest TS version installed.
d
@Ryan Hi Ryan. Thanks for getting back so fast 🙂 I’m on the latest typescript. I also tried to check if “Keys” should be a reserved keyword but that came up empty. Do I have to rename the actual table or can I do some sort of manual mapping?
@Ryan Renamed model to
KRKeys
and added
@@map("Keys")
That seemed to do it. Thanks for the tip!
🙌 1