Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate tsx #1169

Closed
72636c opened this issue May 10, 2023 · 5 comments
Closed

Investigate tsx #1169

72636c opened this issue May 10, 2023 · 5 comments
Labels
wontfix This will not be worked on

Comments

@72636c
Copy link
Member

72636c commented May 10, 2023

It looks like this has a REPL, which was the historical reason to stick with ts-node.

https://github.com/esbuild-kit/tsx

@AaronMoat
Copy link
Contributor

AaronMoat commented Nov 22, 2023

The REPL is quite a different experience to ts-node in pasting code in and stuff. Try pasting in a multiline function:

function x(a: { a: 1, b: 2 }): 2 {
    return a.b;
}
$ npx ts-node
> function x(a: { a: 1, b: 2 }): 2 {
...     return a.b;
... }
undefined
>
$ npx tsx
Welcome to Node.js v18.13.0.
Type ".help" for more information.
> function x(a: { a: 1, b: 2 }): 2 {
    return a.b;
}function x(a: { a: 1, b: 2 }): 2 {
            ^

Uncaught SyntaxError: Unexpected token ':'
> var __getOwnPropNames=Object.getOwnPropertyNames;var __commonJS=(cb,mod)=>function __require(){return mod||(0,cb[__getOwnPropNames(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports};var require_REPL2=__commonJS({"REPL2.js"(){return a.b}});export default require_REPL2();
                                                                                                                                                                                                                                                  ^^^^^^

Uncaught SyntaxError: Unexpected token 'export'
> }

edit: privatenumber/tsx#250

@72636c 72636c added the wontfix This will not be worked on label Nov 22, 2023
@72636c
Copy link
Member Author

72636c commented Nov 22, 2023

🥲

@72636c 72636c closed this as completed Nov 22, 2023
@samchungy
Copy link
Contributor

samchungy commented Nov 22, 2023

Would you normally paste in a command?

I would think the normal usecase would be running a file

@AaronMoat
Copy link
Contributor

running a file

In that case tsx would be fine as there's no REPL involved, right?

I guess the question here is whether the REPL is actually used?

@samchungy
Copy link
Contributor

Oh true I should read the issue better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants