question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`$extends` TS error: "Inferred type of this node exceeds the maximum length the compiler will serialize" with `"declaration": true` in `tsconfig`

See original GitHub issue

The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.

This error also showed up in another project.

Screenshot from 2022-11-30 12-46-59

Source file. To reproduce, check out main, and upgrade to Prisma 4.7

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Reactions:2
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
aqrlncommented, Nov 30, 2022

Hi @mshd and thank you for your report! This error is related to failure to emit declarations — notice that despite the error, if you hover the mouse over the variable in your editor, you can still see that TypeScript infers a type. Adding

"compilerOptions": {
  "declaration": false
}

to tsconfig.json prevents the issue, so this is the workaround for now. We will work on investigating and fixing the root cause, as of course the functionality should work regardless of this compiler option. Thanks for bringing this to our attention.

0reactions
mshdcommented, Dec 1, 2022

@millsp I think it’s only related to declaration: true. @aqrln Thanks so much, this solved it for now. @miguelff By using your repro.zip and adding declaration: true in tsconfig.json, you can reproduce the error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript: "The inferred type of this node exceeds the ...
"The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed." This was working ......
Read more >
TSConfig Reference - Docs on every TSConfig option
An error occurs if any of the files can't be found. {. " compilerOptions ": {},. " files ": [. "core.ts",. "sys.ts",. "types.ts",....
Read more >
Prisma 4.8.0 Release - GitClear
Prisma 4.3. · enum fields are missing in select's type when clientExtensions preview feature is used · $extends TS error: "Inferred type of...
Read more >
Zod | Documentation
Zod is a TypeScript-first schema declaration and validation library. I'm using the term "schema" to broadly refer to any data type, from a...
Read more >
TypeScript: src/compiler/diagnosticMessages.json - Fossies
{ 187 "category": "Error", 188 "code": 1061 189 }, 190 "Type is referenced ... 1023 "'infer' declarations are only permitted in the 'extends'...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found