Re:Facebook Launches Flow, Static Type Checker for JavaScript
by masklinn on Tuesday November 18, 2014 @01:51PM
(#8625544)
TS bolts on a straightforward nominative type system without type unions (or non-nullable types), so it can't handle a variable typed as `number | string`, it'll immediately drop down to `any`. That is, flow aims to remain useful in the face of more JS idioms. It won't make a difference between nullable and non-nullable either, so AFAIK
can never be a compile-time error in typescript.
[ Parent
| on HN ]
Re:Facebook Launches Flow, Static Type Checker for JavaScript
by Arnavion on Tuesday November 18, 2014 @01:53PM
(#8625558)
Union types are present in the master branch of the TS compiler. The compiler also uses instanceof and typeof === ... to reduce the range of types inside a branch, similar to Flow.
Re:Facebook Launches Flow, Static Type Checker for JavaScript
by johnny_reilly on Wednesday November 19, 2014 @07:54AM
(#8629690)
Due to ship with TypeScript 1.4 - see recent blog post: http://blogs.msdn.com/b/typescript/archive/2014/11/18/what-s...
Re:Facebook Launches Flow, Static Type Checker for JavaScript
by DougBTX on Tuesday November 18, 2014 @01:56PM
(#8625579)
Yep, here's some related discussion: https://github.com/Microsoft/TypeScript/issues/185
tl;dr: they want to support both of those features, the question is what syntax to use and how to introduce those features into the existing ecosystem.