jonathanj
jonathanj8mo ago

TS7056: The inferred type of this node exceeds the maximum length the compiler will serialize.

I have tsc complaining about my root app router type being too large when using --declarations. There was a ticket from 2022 about this, but it seems to have been closed as solved. There are some Zod tickets about this too, but unfortunately they don't provide solutions that are viable (e.g. disabling --declaration is not viable for me.) It seems like this is caused by having a large app router, where "large" means it has a bunch of endpoints, and the total combination of those endpoints' input and output validators (using Zod schemas) go above a certain threshold. I can solve it by strategically adding explicit types to some of the query/mutation handler function definitions, but it's a bit odd.
GitHub
[v10] bug: TypeScript not willing to serialize the type of my clien...
Provide environment information System: OS: macOS 12.5 CPU: (10) arm64 Apple M1 Pro Memory: 152.64 MB / 32.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/...
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?