Skip to content
DevMeme
3685 of 7590
Languages Post #4024 · source on Telegram

The TypeScript Type System: A Journey to the Bottom of the Iceberg

Description

This image uses the popular iceberg meme format to illustrate the escalating complexity of TypeScript's type system. The top of the iceberg, visible above the water, lists fundamental and widely understood concepts like 'annotations', 'interfaces', 'enums', and 'abstract/private/protected'. Just below the surface are intermediate features that proficient developers use regularly, such as 'generic types', utility types like 'Omit, Pick, Exclude', and 'recursive types'. Deeper down, in the dark water, lie the advanced and more esoteric features like 'conditional types', the 'infer' keyword, and the 'never' type. At the absolute bottom, in the abyss, is a small screenshot of 'extreme' TypeScript type challenges, including tasks like 'Query String Parser' and 'DistributeUnions', representing the pinnacle of type-level programming. The meme humorously and accurately portrays the developer's journey into TypeScript, starting with simple type annotations and descending into a powerful, Turing-complete system that few ever fully master. It's relatable to any senior developer who has realized the surprising depth hidden beneath the language's initial simplicity

Comments

18
Anonymous ★ Top Pick The top of the TypeScript iceberg is what you show the project manager. The bottom is what you use to write a type-safe CSS-in-JS library that makes the compiler cry
  1. Anonymous ★ Top Pick

    The top of the TypeScript iceberg is what you show the project manager. The bottom is what you use to write a type-safe CSS-in-JS library that makes the compiler cry

  2. Anonymous

    “Product: ‘Just add an enum.’ One sprint later the “enum” is a 150-line recursive conditional that quick-sorts distributive unions, tsc takes longer than our CI build, and yes - management still calls it “just JavaScript with types.”

  3. Anonymous

    The skeleton at the bottom isn't dead from waiting for the build to finish - it's from trying to explain to the PM why implementing a simple form now requires a PhD in category theory and three weeks of type gymnastics

  4. Anonymous

    TypeScript's type system is Turing-complete, which means somewhere down there the compiler is solving your business logic and your runtime is just a formality

  5. Anonymous

    This iceberg perfectly captures the TypeScript journey: you start with 'let x: string' feeling accomplished, then six months later you're debugging 'type DeepReadonly<T> = T extends object ? { readonly [K in keyof T]: DeepReadonly<T[K]> } : T' at 2 AM, questioning every life choice that led you here. The real horror isn't the complexity - it's realizing that the 'extreme +2' challenges at the bottom are exactly what your coworker used in production to 'ensure type safety' for a simple form validator

  6. Anonymous

    Every TS migration starts with 'interfaces and enums' and ends with a PR where a distributed conditional type with infer parses query strings and sorts arrays at compile time, because doing it at runtime would be less type-safe

  7. Anonymous

    We promised to “just add types” - now we ship a compile-time query‑string parser stitched with infer chains, tsc is our second interpreter, and the build farm files an SLO against distributive unions

  8. Anonymous

    TypeScript iceberg: interfaces for the resume, infer/never for when you need to prove job security

  9. dev_meme 4y

    what language?

    1. @RiedleroD 4y

      any

      1. @romash1408 4y

        How many languages have Partial or keyof?

        1. @RiedleroD 4y

          isn't keyof just a function to get the key of a value from a dict? So… pretty much every lang with dicts, no?

          1. @romash1408 4y

            Keyof is type operator https://www.typescriptlang.org/docs/handbook/2/keyof-types.html I know not many languages, but only typescript gives me make such things with types

            1. @RiedleroD 4y

              that's a weird-ass keyword

        2. @saniel42 4y

          Too hard to just give an answer?

      2. @ledzz1994 4y

        unknown

  10. @energizer91 4y

    ts?

    1. @dsmagikswsa 4y

      Yes looks like it. The never make me think of ts

Use J and K for navigation