repl: add experimental TypeScript support#64077
Conversation
|
Review requested:
|
| added: REPLACEME | ||
| --> | ||
|
|
||
| > Stability: 1.2 - Release candidate |
There was a problem hiding this comment.
The underlying transformer, https://nodejs.org/api/module.html#modulestriptypescripttypescode-options, is a release candidate, I figured this would be an extension of that
There was a problem hiding this comment.
I think this has a larger scope than that api
| assert.match(output.accumulator, /3\n> /); | ||
|
|
||
| // Transform TypeScript to JavaScript and evaluate it | ||
| input.emit('data', 'enum Color { Red, Green, Blue }\n'); |
There was a problem hiding this comment.
Can you add a test for:
const foo = () => 'hello world'; foo<Object>();
If should return false. This basically makes sure valid js is evaluated before ts
|
This is going to cause problems with multiline, I suspect. Concise example: const regexps = new Set<
RegExp
>();If typed as multiline input to REPL, it's going to consider the statement complete after the second newline, as it's a valid JS statement, and evaluate |
|
It should be handled exactly like we handle the |
Signed-off-by: avivkeller <me@aviv.sh>
| bool allow_ffi = false; | ||
| bool allow_worker_threads = false; | ||
| bool experimental_repl_await = true; | ||
| bool experimental_repl_typescript = false; |
There was a problem hiding this comment.
| bool experimental_repl_typescript = false; | |
| bool experimental_repl_typescript = EXPERIMENTALS_DEFAULT_VALUE; |
Adds experimental TypeScript support to the REPL, opt-in-able via the
--experimental-repl-typescriptflag.