Open dielsalder opened 3 months ago
Is there a reason you need declaration: true
in your tsconfig? Typically this isn't necessary for application code. https://stackoverflow.com/questions/68463963/typescript-the-inferred-type-of-this-node-exceeds-the-maximum-length-the-compi
If you need declaration files for some reason, you may have to tweak the generation code to include explicit type declarations, as the error message says.
If that's not workable, I'm afraid you'll have to wait for Zod 4 which will dramatically simplify a lot of internal type representations. Sorry for not having better news, that error is always a doozy.
Is there a reason you need
declaration: true
in your tsconfig?
Monorepos are: they require composite: true
, which in turn requires declaration: true
.
I work in a monorepo and I don't need composite neither declaration.
In our project, it happens on typescript 5.6.2 but 5.5.4 works fine.
@thelinuxlich When I set "declaration": false
I get the following error:
TS6304: Composite projects may not disable declaration emit.
Like I said, I don't use composite on my monorepo.
Could you please share a bit more about your setup? You cannot disable declaration
if you set composite: true
. And that in turn is required if you want to make use of references, which I would say is the essence of a monorepo.
Please take a look at this great article by Colin: https://colinhacks.com/essays/live-types-typescript-monorepo
I go with the third approach, using paths
Hi guys. I'm pretty new to Zod. I have a project with some large schemas and I am frequently running into this error:
It seems that it has to do mainly with typescript hitting a hard maximum for schemas of a certain size, as I can trigger it just by adding or removing one property on a schema. Splitting the big schema into multiple variables or files does not help.
Would like to know if there are any good workarounds to this. There has been a past issue but none of the solutions in that thread have helped for me. The only thing I haven't tried is to monkey-patch tsc, but I would like to avoid that.
Thanks!