Skip to content
DevMeme
6651 of 7590
Languages Post #7286 · source on Telegram

JavaScript vs TypeScript Two Guys on Bus Both Sad Different Error Messages

Description

A meme using the 'two people sitting on opposite sides of a bus both looking sad at a rainy window' template. The left person has a JS (JavaScript) logo overlay and an error popup reading 'Uncaught TypeError: Cannot read properties of undefined (reading "map") at App (App.jsx:11:14) at renderWithHooks (react-dom.developme'. The right person has a TS (TypeScript) logo overlay and a massive TypeScript error message reading 'No overload matches this call. Overload 1 of 2, "(props: Omit<Omit<{ children?: ReactNode; color?: Color; disabled?: boolean; disableElevation?: boolean;...' with extensive type gymnastics involving ReactNode, CommonProps, Pick, Partial, and theme types. Both are equally miserable but for very different reasons -- JS gets cryptic runtime errors while TS gets novel-length compile-time type errors

Comments

10
Anonymous ★ Top Pick JavaScript: your app crashes at runtime because undefined is not a function. TypeScript: your app never compiles because the type system wrote a doctoral thesis about why your button props are wrong
  1. Anonymous ★ Top Pick

    JavaScript: your app crashes at runtime because undefined is not a function. TypeScript: your app never compiles because the type system wrote a doctoral thesis about why your button props are wrong

  2. Anonymous

    JavaScript lets you discover your mistakes in production at 3 AM. TypeScript lets you discover them at 3 PM, after a six-hour fight with a generic type that's somehow simultaneously a string and not a string

  3. Anonymous

    Sure, TypeScript’s compiler writes you a novel every build, but at least it lets you skip the midnight safari for that one undefined ‘map’ crashing prod

  4. Anonymous

    After 15 years of shipping production code, you realize the real type safety was the runtime errors we avoided along the way - but at what cost? Three screens of compiler output just to tell you that you forgot a question mark in an optional prop

  5. Anonymous

    TypeScript: where you trade runtime surprises for compile-time existential dread and error messages longer than your sprint retrospective

  6. Anonymous

    TypeScript's type guards lulled you into safety, but React props whispered 'undefined' at runtime - welcome to the eternal frontend merge conflict

  7. Anonymous

    Choose your view: JS gives you undefined.map at 3am via PagerDuty; TS gives you a 300-line refusal in CI at 3pm - after two decades, I’ll take the compiler yelling over customers yelling

  8. @NaNmber 10mo

    mfw

  9. @jcdkiki 10mo

    They haven't seen errors in templated C++ code yet.

    1. Deleted Account 10mo

      exactly

Use J and K for navigation