Open redstonekasi opened 1 year ago
This will mainly be fixed via https://github.com/esbuild-kit/tsx/pull/205
Currently, it seems the patch affects custom REPL instances. Do you think it's expected for them to get TypeScript when executed with tsx?
I'm thinking not, and that the patch should only be applied to the Node.js REPL.
I agree. While REPL instances are probably mainly going to be used for JS, they can also be used for other purposes when defining a custom evaluation function, which is why the patch should only be applied to the Node.js REPL.
Also even ignoring that, there should not be a noticeable difference between running code through tsx
and running compiled code using node
.
I just hit a similar bug using tsx version 4.11.0 .
The bug I'm seeing is that input from the repl is transformed.
If I use a very simple script to see the output:
const repl = require('repl');
repl.start({
eval: line => {
console.log('The line was: ' + line);
}
});
And I try entering input with dashes like: some-command
I'm expecting it to print:
The line was: some-command
What I actually see when running this inside TSX:
The line was: some - command;
Bug description
I was trying out making a custom REPL using Node's
repl
module when I came across this bug that was presumably introduced in #125. When running a file using tsx the patch affects the script that was run.Screenshot of expected and actual behaviour (
repl.ts
is the reproduction code below)Reproduction
Environment
Can you work on a fix?