Deno REPL 无法识别 TypeScript 变量声明

Deno REPL cannot recognize TypeScript variable declaration

我使用 Chocolatey 在 Windows 10 上安装了 Deno 1.0.5。我尝试在 Deno REPL 中使用 Typescript,但显然它无法识别 TypeScript 变量声明 if the type is set:

 C:\>deno
 Deno 1.0.5
 exit using ctrl+d or close()
 > let x: number;
 Uncaught SyntaxError: Unexpected token ':'
     at evaluate ($deno$/repl.ts:54:34)
     at Object.replLoop ($deno$/repl.ts:156:13)
 > let x: number = 42;
 Uncaught SyntaxError: Unexpected token ':'
     at evaluate ($deno$/repl.ts:54:34)
     at Object.replLoop ($deno$/repl.ts:156:13)
 > let x = 42;
 undefined
 > x
 42

我是否需要做一些特殊的事情来使 Deno CLI 支持 TypeScript?

Deno REPL 尚不支持 typescript。

请参阅以下旧问题:https://github.com/denoland/deno/issues/1158 仍处于打开状态。

Ryan Dahl 对添加 TS 支持的 PR 的评论:

2020 年 2 月 24 日

Just a bit more context for future researchers: There are many things we can do to improve the REPL without introducing the TS compiler. We should do those things first (e.g. improve inspect, tab completion). Once we're on par with Node's REPL, we can start looking into how to go beyond that by using typescript.