prisma: Installed @prisma/client@4.8.0 without schema throws implicit error on PrismaClientExtends in .prisma/client
Update 2023-05-24
it’s appearing also on 4.14.1 (updated the sample as well)
Bug description
If you set up a minimalistic project without a schema file, which imports @prisma/client then the build with skipLibCheck: false, returns an issue coming from .prisma/client
This worked fine on version 4.7.1 but was introduced in version 4.8.0
This issue blocks the nexus-prisma
build unless skipLibCheck: true is enabled.
An error from the build step.
node_modules/.prisma/client/index.d.ts:45:9 - error TS2589: Type instantiation is excessively deep and possibly infinite.
45 }) => PrismaClientExtends<runtime.Types.Utils.PatchDeep<Args, ExtArgs>>)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/.prisma/client/index.d.ts:45:29 - error TS2344: Type '{ [K in keyof (Args & ExtArgs)]: any; }' does not satisfy the constraint 'RequiredArgs'.
Type '{ [K in keyof (Args & ExtArgs)]: any; }' is not assignable to type 'NameArgs'.
Types of property 'name' are incompatible.
Type '("name" extends keyof Args ? keyof Args & "name" extends keyof ExtArgs ? Args[keyof ExtArgs & keyof Args & "name"] extends object ? ExtArgs[keyof ExtArgs & ... 1 more ... & "name"] extends object ? Args[keyof ExtArgs & ... 1 more ... & "name"] extends Function ? Args[keyof ExtArgs & ... 1 more ... & "name"] : ExtArg...' is not assignable to type 'string | undefined'.
Type '"name" extends keyof Args ? keyof Args & "name" extends keyof ExtArgs ? Args[keyof ExtArgs & keyof Args & "name"] extends object ? ExtArgs[keyof ExtArgs & ... 1 more ... & "name"] extends object ? Args[keyof ExtArgs & ... 1 more ... & "name"] extends Function ? Args[keyof ExtArgs & ... 1 more ... & "name"] : ExtArgs...' is not assignable to type 'string | undefined'.
Type '(keyof Args & "name" extends keyof ExtArgs ? Args[keyof ExtArgs & keyof Args & "name"] extends object ? ExtArgs[keyof ExtArgs & ... 1 more ... & "name"] extends object ? Args[keyof ExtArgs & ... 1 more ... & "name"] extends Function ? Args[keyof ExtArgs & ... 1 more ... & "name"] : ExtArgs[keyof ExtArgs & ... 1 more...' is not assignable to type 'string | undefined'.
Type 'keyof Args & "name" extends keyof ExtArgs ? Args[keyof ExtArgs & keyof Args & "name"] extends object ? ExtArgs[keyof ExtArgs & ... 1 more ... & "name"] extends object ? Args[keyof ExtArgs & ... 1 more ... & "name"] extends Function ? Args[keyof ExtArgs & ... 1 more ... & "name"] : ExtArgs[keyof ExtArgs & ... 1 more ...' is not assignable to type 'string | undefined'.
Type '(Args[keyof ExtArgs & keyof Args & "name"] extends object ? ExtArgs[keyof ExtArgs & keyof Args & "name"] extends object ? Args[keyof ExtArgs & ... 1 more ... & "name"] extends Function ? Args[keyof ExtArgs & ... 1 more ... & "name"] : ExtArgs[keyof ExtArgs & ... 1 more ... & "name"] extends Function ? Args[keyof Ext...' is not assignable to type 'string | undefined'.
Type 'Args[keyof ExtArgs & keyof Args & "name"] extends object ? ExtArgs[keyof ExtArgs & keyof Args & "name"] extends object ? Args[keyof ExtArgs & ... 1 more ... & "name"] extends Function ? Args[keyof ExtArgs & ... 1 more ... & "name"] : ExtArgs[keyof ExtArgs & ... 1 more ... & "name"] extends Function ? Args[keyof ExtA...' is not assignable to type 'string | undefined'.
Type 'Args[keyof ExtArgs & keyof Args & "name"] | (ExtArgs[keyof ExtArgs & keyof Args & "name"] extends object ? Args[keyof ExtArgs & ... 1 more ... & "name"] extends Function ? Args[keyof ExtArgs & ... 1 more ... & "name"] : ExtArgs[keyof ExtArgs & ... 1 more ... & "name"] extends Function ? Args[keyof ExtArgs & ... 1 mo...' is not assignable to type 'string | undefined'.
Type 'ExtArgs[keyof ExtArgs & keyof Args & "name"] extends object ? Args[keyof ExtArgs & keyof Args & "name"] extends Function ? Args[keyof ExtArgs & ... 1 more ... & "name"] : ExtArgs[keyof ExtArgs & ... 1 more ... & "name"] extends Function ? Args[keyof ExtArgs & ... 1 more ... & "name"] : { [K in keyof (Args[keyof ExtA...' is not assignable to type 'string | undefined'.
Type '(Args[keyof ExtArgs & keyof Args & "name"] extends Function ? Args[keyof ExtArgs & keyof Args & "name"] : ExtArgs[keyof ExtArgs & ... 1 more ... & "name"] extends Function ? Args[keyof ExtArgs & ... 1 more ... & "name"] : { [K in keyof (Args[keyof ExtArgs & ... 1 more ... & "name"] & ExtArgs[keyof ExtArgs & ... 1 mo...' is not assignable to type 'string | undefined'.
Type 'Args[keyof ExtArgs & keyof Args & "name"] extends Function ? Args[keyof ExtArgs & keyof Args & "name"] : ExtArgs[keyof ExtArgs & ... 1 more ... & "name"] extends Function ? Args[keyof ExtArgs & ... 1 more ... & "name"] : { [K in keyof (Args[keyof ExtArgs & ... 1 more ... & "name"] & ExtArgs[keyof ExtArgs & ... 1 mor...' is not assignable to type 'string | undefined'.
Type 'Args[keyof ExtArgs & keyof Args & "name"] | (ExtArgs[keyof ExtArgs & keyof Args & "name"] extends Function ? Args[keyof ExtArgs & ... 1 more ... & "name"] : { [K in keyof (Args[keyof ExtArgs & ... 1 more ... & "name"] & ExtArgs[keyof ExtArgs & ... 1 more ... & "name"])]: K extends keyof Args[keyof ExtArgs & ... 1 mo...' is not assignable to type 'string | undefined'.
Type 'ExtArgs[keyof ExtArgs & keyof Args & "name"] extends Function ? Args[keyof ExtArgs & keyof Args & "name"] : { [K in keyof (Args[keyof ExtArgs & ... 1 more ... & "name"] & ExtArgs[keyof ExtArgs & ... 1 more ... & "name"])]: K extends keyof Args[keyof ExtArgs & ... 1 more ... & "name"] ? K extends keyof ExtArgs[keyof ...' is not assignable to type 'string | undefined'.
Type 'Args[keyof ExtArgs & keyof Args & "name"] | { [K in keyof (Args[keyof ExtArgs & keyof Args & "name"] & ExtArgs[keyof ExtArgs & keyof Args & "name"])]: K extends keyof Args[keyof ExtArgs & ... 1 more ... & "name"] ? K extends keyof ExtArgs[keyof ExtArgs & ... 1 more ... & "name"] ? Args[keyof ExtArgs & ... 1 more ......' is not assignable to type 'string | undefined'.
Type '{ [K in keyof (Args[keyof ExtArgs & keyof Args & "name"] & ExtArgs[keyof ExtArgs & keyof Args & "name"])]: K extends keyof Args[keyof ExtArgs & ... 1 more ... & "name"] ? K extends keyof ExtArgs[keyof ExtArgs & ... 1 more ... & "name"] ? Args[keyof ExtArgs & ... 1 more ... & "name"][K] extends object ? ExtArgs[keyof...' is not assignable to type 'string'.
45 }) => PrismaClientExtends<runtime.Types.Utils.PatchDeep<Args, ExtArgs>>)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 2 errors in the same file, starting at: node_modules/.prisma/client/index.d.ts:45
How to reproduce
- Clone https://github.com/rostislav-simonik/prisma-client-type-issue
- yarn
- yarn build
Expected behavior
Should build without any issues
Prisma information
No schema involved
Environment & setup
- OS: macOS, Windows, Debian
- Database: No database is involved in the given phase
- Node.js version: 14.x, 16.x 18.x
https://github.com/graphql-nexus/nexus-prisma/pull/332
Prisma Version
prisma : 4.8.0
@prisma/client : 4.8.0
Current platform : darwin
Query Engine (Node-API) : libquery-engine d6e67a83f971b175a593ccc12e15c4a757f93ffe (at node_modules/@prisma/engines/libquery_engine-darwin.dylib.node)
Migration Engine : migration-engine-cli d6e67a83f971b175a593ccc12e15c4a757f93ffe (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core d6e67a83f971b175a593ccc12e15c4a757f93ffe (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary : prisma-fmt d6e67a83f971b175a593ccc12e15c4a757f93ffe (at node_modules/@prisma/engines/prisma-fmt-darwin)
Format Wasm : @prisma/prisma-fmt-wasm 4.8.0-61.d6e67a83f971b175a593ccc12e15c4a757f93ffe
Default Engines Hash : d6e67a83f971b175a593ccc12e15c4a757f93ffe
Studio : 0.479.0
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (6 by maintainers)
I added an issue for it here: https://github.com/prisma/prisma/issues/19905
@Jolg42 It’s a very tiny change.
The problem appears to be this type definition: https://github.com/prisma/prisma/blob/785905e7e86b8d94627fb18e3d09d860a710dc46/packages/client/src/runtime/core/types/Utils.ts#L52
The problem disappears if I change it to the following in my generated client:
I think the problem is that saying
Key in string
means each value in the union of every possible string, causing typescript to expand the type infinitely.Did you create an issue for this? I’ve managed to solve the problem by making a small change to the generated type and would like to contribute.
@ariofrio Could you open a new issue and provide the necessary info to attempt a reproduction? I’m curious to know if it’s reproducible on the newer versions like you said and not-reproducible on older versions (which ones)?
ok, looks like that’s what fixed the issue, thx. Closing ticket.
@698373862 Please use
4.7.1
for now. This has a good chance to make it into the next4.9.0
release. So, keep an eye on this issue to know when it’s resolved.Thanks for reporting & thanks for the super handy reproduction @rostislav-simonik - We are looking into it.