Should TypeScript support runtime types instead of relying on Zod? A developer is proposing that TypeScript add an optional compiler flag to preserve enough type information to generate JSON Schema at runtime, eliminating the need to duplicate native TypeScript types in Zod or JSON Schema for structured output. The developer argues the duplication wastes tokens whenever both a type definition and its schema are sent to a model, and notes coding agents like Claude and Codex often generate unit tests just to verify the conversion is correct. The proposal is illustrated with a small playground showing a TypeScript type flowing through the compiler to a runtime JSON Schema. 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: