This is an incomplete list of tools that aid in detecting type errors in JavaScript and statically typed languages that compile to JavaScript.
-
Flow is a type checker with gradual typing capabilities, classes, parametric polymorphism with constraints (bounded polymorphism), function overloading, union and intersection types, and modules.
-
TypeScript is a typed superset of JavaScript (todo: which version? ES6/7?) backed by Microsoft.It features contextual typing, interfaces and classes, parametric polymorphism (generics with constraints), enums, union types, decorators, and modules and namespaces.
- See also: A Tumblr Engineering blog post about their experience with Flow and TypeScript.
-
Fay is a subset of Haskell, so it inherits its semantics, i.e. it's pure and lazy by default. It supports GADTs and provides a thin FFI layer.
-
PureScript is a Haskell-like language with algebraic data types, type classes, higher-kinded types, modules, extensible records, TCO, and an Eff monad. It shows how code dealing with the DOM and callbacks, which would look unwieldly in vanilla JavaScript, can be made beautiful with functional syntax, higher-order functions and do-notation.
Its syntax and types are very similar to Haskell, so the barrier of entry is very low for those who know it. There's a huge number of libraries ported from Haskell to PureScript, too.
-
Elm has a syntax similar to Haskell or Miranda. It's a bit simpler than PureScript, but still has many convenient features: pattern matching, extensible records, union types, and modules. It's primarily aimed at creating interactive web interfaces in a functional manner.
-
Haxe is a toolkit for cross-platform app development with a statically-typed language which can be compiled to JavaScript. Its type system is not as extensive as that of Haskell or PureScript.
-
BuckleScript is a JavaScript backend for OCaml targetted primarily at Node and npm. Supports all the shiny things that OCaml does, such as modules, functors, polymorphic variants and GADTs.
More reading: https://engineering.tumblr.com/post/165261504692/flow-and-typescript