A typescript REPL (command line interpreter)

A simple typescript REPL.
Usage: tsi

  -h, --help     Print this help message                           
  -f, --force    Force tsi to evaluate code with typescript errors.
  -v, --verbose  Print compiled javascript before evaluating.      

tsi runs on node.js and can easily be installed through npm.

npm install -g tsi

The bin directory includes the current build of tsi. If you would like to rebuild it though, just run

npm run-script build
$ tsi
> var square = (x: number) => x * x;
> square(5);
> square('foo');
error TS2081: Supplied parameters do not match any signature of call target.
error TS2087: Could not select overload for 'call' expression.

You can't change the type of variable after it's been declared:

$ tsi
> var x = 5;
> x = 'hi';
error TS2011: Cannot convert 'string' to 'number'.

You can't redeclare variables (in particular, to get around the previous caveat):

$ tsi
> var x = 1;
> var x = 'hi';
error TS2000: Duplicate identifier 'x'.