Claude Fable 5 vs GPT-4o for TypeScript Codegen A developer compared Claude Fable 5 and GPT-4o on TypeScript code generation tasks, finding that each model has distinct failure modes. Claude Fable 5 is stronger with generics and strict mode but struggles with deeply nested discriminated unions, while GPT-4o is consistent on simple inference but more likely to mishandle advanced patterns like conditional types and unhandled promise rejections. Which model actually writes better TypeScript, and does it matter enough to change what you reach for? I ran Claude Fable 5 and GPT-4o through the same set of TypeScript generation tasks to find out, and the answer is more useful than a leaderboard number: each model has a different failure mode, and which one bites you depends on what you are building. I do a fair amount of AI systems architecture https://mudassirkhan.me/services/ai-systems-architecture work, and picking the right model for codegen inside a pipeline is a decision that compounds. Get it wrong and you are paying for review time on every generated PR. Here is what actually held up under test. I kept the test as fair as I could make it. Both models got the same prompts, the same grading rubric, and no retries. The rubric had three gates: strict: true in tsconfig without new errors.Each task was a well defined, realistic TypeScript problem: shaping a typed API response, modeling a tagged union for a state machine, and writing an async function with proper error boundaries. I ran every prompt through both models and scored the output against the rubric, so any difference in output is attributable to the model, not to the prompt or the grading. | Test dimension | What I checked | |---|---| | Compiles clean | Zero manual fixes needed | | Strict mode | No new errors under strict: true | | Error handling | No silent unhandled rejections | | Schema validation | Runtime safety at the API boundary, not just compile time types | Both models are competent at basic type inference, but they trip up in different spots once things get less trivial. Claude Fable 5 is generally stronger with generics and utility types, and it tends to produce output that survives strict mode without hand holding. Where it struggles more is deeply nested discriminated unions. It occasionally misses an edge case in the union or narrows a branch incorrectly, so you still want a human pass on anything with more than two or three variants. GPT-4o is consistent on simple and intermediate inference, but it is more likely to fall over on advanced patterns like conditional types or heavily generic utility helpers. Here is a discriminated union pattern that is a decent stress test for either model: type RequestState