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