042: Comparing TypeScript and Elm's Type Systems

October 25, 2021 1:08:57 66.22 MB Downloads: 0

TypeScript's any vs. Elm's Debug.todo

TypeScript's any essentially "turns off" type checking in areas that any passes through.

In Elm:

  • You can get a type that could be anything with Debug.todo, but you can't build your app with --optimize if it has Debug.todo's in it
  • You will still get contradictions between inconsistent uses of a type that could be anything (see this Ellie example)

This Ellie example (with compiler error as expected) and this TypeScript playground example (with no error) show the difference.