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

Allow setting 'allowNamespaces' in typescript preset #10382

Merged
merged 2 commits into from Sep 3, 2019
Merged

Allow setting 'allowNamespaces' in typescript preset #10382

merged 2 commits into from Sep 3, 2019

Conversation

dsgkirkby
Copy link
Contributor

@dsgkirkby dsgkirkby commented Sep 1, 2019

Q                       A
Fixed Issues? Fixes #10383
Patch: Bug Fix? No
Major: Breaking Change? No
Minor: New Feature? Yes
Tests Added + Pass? Pass: yes, added: no (no existing tests for this preset)
Documentation PR Link babel/website#2092
Any Dependency Changes? No
License MIT

In order to enable babel to be adopted on typescript projects, namespaces support was added in #9785. Enabling this is suggested when encountering a namespace during compilation. However, this can currently only be enabled at the level of babel-plugin-transform-typescript, and so this error is not actionable when using babel-preset-typescript, which is likely the most common way of using typescript with babel.

Using babel-plugin-transform-typescript in order to enable this on projects also requires re-implementing the TSX-handling logic that is in babel-preset-typescript. This change will make it easier to adopt babel for existing typescript projects that use namespaces.

@babel-bot
Copy link
Collaborator

babel-bot commented Sep 1, 2019

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/11436/

jsxPragma,
allExtensions = false,
isTSX = false,
allowNamespaces = false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer not to set a default value here, and let the plugin handle it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, done 👍

@nicolo-ribaudo nicolo-ribaudo added area: typescript PR: New Feature 🚀 A type of pull request used for our changelog categories labels Sep 2, 2019
Copy link
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@JLHwung JLHwung merged commit e5afa57 into babel:master Sep 3, 2019
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Dec 3, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: typescript outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: New Feature 🚀 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lack of further passing of "allowNamespaces" in @babel/preset-typescript
4 participants