TYPEDJS
Save your JavaScript

Sanity Check your JavaScript.

Harness the power of type annotations and program specifications to make your code robust. It's easy to get started.

1. Annotate your functions with type signatures.

add_all :: [Number] -> Number

The function add_all sums a list of numbers. It takes one argument (a list of type Number) and returns a single Number.

my_prop :: {name:String, valid:Boolean} -> Boolean

The function my_prop takes an object with two fields, name (a String) and valid (a Boolean), and it returns a Boolean which depends on the state of valid.

2. TYPEDJS tests the annotated functions automatically.

Why not give it a try in this window?

Open your console and type: TypedJS.run_tests()

3. Find some bugs (but probably not all of them)

Type signatures specify program correctness

TYPEDJS uses a function's type signature to generate input parameters, and evaluates the function upon these inputs to form a test case. This test case fails if an exception occurs, or the output violates function constraints. While type signatures provide a limited form of program specification, TYPEDJS adds a quick and rigorous sanity check to your deployment pipeline. The code lives on github.