TypeScript's type system -- how does it compare to Julia's?



I recently watched the video of Anders Hejlsberg’s talk at Microsoft Build 2018, What’s New in TypeScript, and besides finding it quite interesting in its own, I thought it had lots of content that could be relevant to the Julia community, considering that a sizeable portion of the talk was dedicated to, in the author’s own words, “geeking out about TypeScript’s type system”. Here are some moments within that part of the talk that I thought could be useful/interesting to link to others here:

  • 18:10 – start of section about TypeScript’s type system, beginning with an overview of its properties as a whole.
  • 25:54 – start of more in-depth look at specific types in the type system. In particular, it begins with a nice visualization of types as sets built from values (“Unit types”), then leading to an intuitive explanation of TypeScript’s union and intersection types.
  • 34:57 to 39:26 – explanation of conditional types, and how they allow avoiding the manual definition of method overloads. This bit was the one that made me think of Julia the most, due to the obvious connection to multiple dispatch.

I’m curious to know what you guys think about the different approaches taken by Julia and TypeScript in regards to the type system design, in light of what this talk presents.

Also, if anyone knows of good resources (blog posts, videos, GitHub/Discourse threads, etc.) comparing the type systems of Julia and TypeScript, please share them too!