I installed Deno 1.0.5 on Windows 10, using Chocolatey. I tried to use Typescript in the Deno REPL, but apparently it cannot recognize TypeScript variable declarations 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
Do I need to do something special to make Deno CLI support TypeScript?
Deno REPL does not support typescript yet.
See the following old issue: https://github.com/denoland/deno/issues/1158 which is still open.
Comment from Ryan Dahl on a PR that adds TS support:
Feb 24, 2020
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With