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: Aviv Keller <me@aviv.sh>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #64077 +/- ##
=======================================
Coverage 90.13% 90.14%
=======================================
Files 741 741
Lines 241976 241998 +22
Branches 45543 45544 +1
=======================================
+ Hits 218116 218140 +24
+ Misses 15379 15378 -1
+ Partials 8481 8480 -1
🚀 New features to boost your workflow:
|
Adds experimental TypeScript support to the REPL, opt-in-able via the
--experimental-repl-typescriptflag.