Today I discovered tsx, a REPL that evalutes TypeScript. You can run it with npx:

npx tsx

And it evaluates TypeScript.

> const onClick = (input: number):void => input + 1
undefined
> onClick(1)
2

It does not check types, so you can run this just fine:

> const greeting: number = "Hello world!" // Number, or string?
undefined

For that, you’ll need a compiler like tsc. tsx can transpile TypeScript, but it does not type-check it.