jonathanj
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.2 replies