# Should TypeScript support runtime types instead of relying on Zod?

> Source: <https://twitter.com/mykhailen/status/2102442831314842034>
> Published: 2026-09-22 17:06:30+00:00

I like TypeScript almost as much as I like C# (phew, almost 20 years together). One thing that has always been both useful and painful is the lack of runtime types.
On one hand, it's great that TypeScript types disappear at runtime and don't increase the bundle size.
On the other hand, we're entering a phase where structured output is becoming much more common. Having to duplicate your native TypeScript types in Zod, JSON Schema, or another schema library starts to feel painful.
Especially from the token-count perspective: every time you send both your type definition and its duplicated schema to a model, you're basically describing the same structure twice.
And I'm not even counting the unit tests that Claude, Codex, and other coding agents often generate just to verify that the conversion is correct.
So why doesn't TypeScript offer an optional compiler flag that preserves enough type information to generate JSON Schema at runtime?
Something like:
TypeScript type → compiler → runtime JSON Schema
I made a small playground showing roughly how I imagine this could work:
