Post

Investigating a TypeScript caching issue that could have a *massive* impact for validators like ArkType, Zod and Valibot. For projects that heavily rely on schema inference like tRPC, fixing this could have a bigger impact than tsgo. Trigger Warning: O(3^N)

Intersections including mapped types are lazily evaluated, but in many cases like this one, it appears they are never properly cached. Every time the type is referenced, it is re-instantiated, leading to O(3^N) scaling☠️

0 reposts9 likes

Would be very curious to learn how you go about investigating this and fixing it; maybe on here or in a blog post? I've been dealing with some mysterious excessively deep errors and it's usually rather difficult to narrow down the cause.