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:
Comments
Post a Comment