"Understanding TypeScript's Structural Type System" by Drew Colthorp

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ก.ย. 2024
  • I was wrong. I thought TypeScript was something like a Java-ey type system layered atop JavaScript, bringing a dose of brittleness and losing the flexibility I appreciated about the warty-yet-ubiquitous multi-paradigm language.
    But that's not it at all! TypeScript radically improves the JavaScript development experience by providing a flexible, light-weight type system for modern EcmaScript. It does so while maintaining a delicate balance: adding a way to enforce assumptions and invariants without removing the flexibility prized by dynamic language developers. This works because TypeScript's type system is structural and not nominal - that is, based on shapes of data instead of identities of types.
    Come see what's cool and exciting about TypeScript's defining feature. We'll show what differentiates a structural type system from a nominal one; how key features of TypeScript provide a powerful language to express invariants about your system; and how TypeScript leverages its knowledge of what code implies about the shapes of data to avoid most of the type system nuisances that put some developers off of statically typed languages.
    Drew Colthorp

ความคิดเห็น • 10

  • @justinkim7202
    @justinkim7202 5 ปีที่แล้ว +16

    This is the exactly what I was looking for for months! I couldn't figure out all these fancy cryptic typings in the TypeScript definitions of some npm modules and I finally get it now. Thank you so much for this talk!

  • @impankratov
    @impankratov 5 ปีที่แล้ว +6

    Very good explanation of some basic typescript capabilities!

  • @nikosc
    @nikosc 4 ปีที่แล้ว +2

    This was unexpectedly great

  • @JosephCaburnay
    @JosephCaburnay 4 ปีที่แล้ว

    This is so awesome that liking it is not enough.

  • @uris77
    @uris77 5 ปีที่แล้ว +1

    fp-ts is a good library that offers things like Maybe, Task, etc.

  • @dawid_dahl
    @dawid_dahl 8 หลายเดือนก่อน

    Btw, loved the talk. Thanks a lot! 🙏🏻

  • @aviflax
    @aviflax 6 ปีที่แล้ว +1

    I loved this talk!

  • @rrr00bb1
    @rrr00bb1 2 ปีที่แล้ว

    This is similar to Go. You just need promises to the compiler, so that it doesn't de-reference things that don't exist.

    • @nanman_chief
      @nanman_chief 2 ปีที่แล้ว

      but Go is nominal typed.

  • @krzysztofgrzybek6695
    @krzysztofgrzybek6695 5 ปีที่แล้ว

    Solid!