TypeScript
Microsoft have released a typed superset of JavaScript called TypeScript. I spent a sizable portion of my life looking at types and JavaScript, in particular Inferring types for JavaScript programmes. I still find the area interesting, and it’s nice to see this new and exciting work. I wonder if TypeScript has a sound type system? I see already that someone on Twitter has pointed out that arrays are mutable and covariant:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
When you run the above you’ll get an error stating that Object #<C> has no method ‘foo’. The Java type system also has covariant arrays, but would prevent the assignment on line 11 at runtime:
1 2 3 4 5 6 7 8 9 10 11 |
|