Posts

Showing posts with the label facebook flow

Try out Facebook’s Flow typechecker online

You can now try out Flow [1] , Facebook’s typechecker for JavaScript, online, at tryflow.org . The following example demonstrates Flow‘s power: function mul(x,y) { return x * y; } mul('a', 'b'); // static error The last line produces a static (“compile time”) error, because Flow infers the signature: function mul(x : number, y : number) : number In contrast, TypeScript infers the following signature (which you can check in the TypeScript Playground ): function mul(x : any, y : any) : number Further reading: Statically typed JavaScript via Microsoft TypeScript, Facebook Flow and Google AtScript

Statically typed JavaScript via Microsoft TypeScript, Facebook Flow and Google AtScript

Update 2014-11-18: Facebook Flow has been released as open source. Its website is flowtype.org . The site mentions plans for Flow’s future . This blog post looks at three initiatives for adding static typing to JavaScript: Microsoft’s TypeScript, Facebook’s Flow and Google’s AtScript. Typing Let’s first clarify some terminology related to typing (excerpted from “ Speaking JavaScript ”). Static versus dynamic In the context of language semantics and type systems, static usually means “at compile time” or “without running a program,” while dynamic means “at runtime.” Static typing versus dynamic typing In a statically typed language, variables, parameters, and members of objects (JavaScript calls them properties) have types that the compiler knows at compile time. The compiler can use that information to perform type checks and to optimize the compiled code. Even in statically typed languages, a variable also has a dynamic type, the type of the variable’s value at a given point at run...