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

Typescript preset does nothing in current REPL beta #8117

Closed
simonbuchan opened this issue Jun 5, 2018 · 10 comments
Closed

Typescript preset does nothing in current REPL beta #8117

simonbuchan opened this issue Jun 5, 2018 · 10 comments
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@simonbuchan
Copy link

Bug Report

Current Behavior

The typescript preset in the repl since 7.0.0-beta.48 doesn't enable any plugins, leading to syntax errors on any typescript syntax.

Input Code

Note the UI shows a version behind due to #6174 - is something still holding up #7039?

Searching for and enabling (the second?) syntax-typescript allows parsing again, so it's something about the preset, not the plugins being broken or something.

@babel-bot
Copy link
Collaborator

Hey @simonbuchan! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

@loganfsmyth
Copy link
Member

This is pending babel/website#1666 because the filename is currently hard-coded to "repl", so the presets doesn't see it as a .ts file.

@loganfsmyth
Copy link
Member

This was a change from https://github.com/babel/babel/pull/7955/files#diff-a31d321b4911bbbc31e1d19a726637c6R30 so that Babel differentiates .js, .ts, and .tsx.

@simonbuchan
Copy link
Author

simonbuchan commented Jun 5, 2018

Alternative fix is to provide allExtensions: true in the preset (and presumably isTSX: true if react is provided, though I assume that just also enables syntax-jsx?)

#7955 seems a little odd to force this, since you could use overrides for the same behavior (though, obviously for more work)

@loganfsmyth
Copy link
Member

We could, but the more we do stuff like that, the more the REPL diverges from what users would actually see in their own project, which I'd rather avoid.

What specifically makes that PR seem odd?

@simonbuchan
Copy link
Author

Right, that makes sense, though the UX about switching to typescript seems like it would be tricky to get feeling right.

Sorry, probably "surprising" is a better term? I just didn't expect plugins to have the power to apply presets per file, so it seems a little magic coming from babel 6. From the tsc side, it makes perfect sense, and means it's much easier to migrate and set up.

@loganfsmyth
Copy link
Member

Sorry, probably "surprising" is a better term?

Fair!

I just didn't expect plugins to have the power to apply presets per file

Yeah, it's all relatively new, but where we're ending up is that presets are allowed to set configuration like that, but plugins don't have nearly as much access to that kind of thing.

@ghost
Copy link

ghost commented Mar 13, 2019

@loganfsmyth
Are you talking about https://babeljs.io/repl ? I really have no clue how to enable typescript support there

@danez
Copy link
Member

danez commented May 25, 2019

Closing as this is website related and there is already discussion in the linked PR.

@danez danez closed this as completed May 25, 2019
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Aug 24, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 24, 2019
@JLHwung
Copy link
Contributor

JLHwung commented Nov 11, 2019

It is now fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants