Node.js 中的 TypeScript REPL

要在 Node.js 中使用 TypeScript REPL,你可以使用 tsun 軟體包

全域性安裝

npm install -g tsun

並使用 tsun 命令在終端或命令提示符下執行

用法示例:

$ tsun
TSUN : TypeScript Upgraded Node
type in TypeScript expression to evaluate
type :help for commands in repl
$ function multiply(x, y) {
..return x * y;
..}
undefined
$ multiply(3, 4)
12