Allow setting 'allowNamespaces' in typescript preset#10382
Merged
JLHwung merged 2 commits intobabel:masterfrom Sep 3, 2019
dsgkirkby:master
Merged
Allow setting 'allowNamespaces' in typescript preset#10382JLHwung merged 2 commits intobabel:masterfrom dsgkirkby:master
JLHwung merged 2 commits intobabel:masterfrom
dsgkirkby:master
Conversation
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/11436/ |
| jsxPragma, | ||
| allExtensions = false, | ||
| isTSX = false, | ||
| allowNamespaces = false, |
Member
There was a problem hiding this comment.
I would prefer not to set a default value here, and let the plugin handle it.
Contributor
Author
There was a problem hiding this comment.
Makes sense, done 👍
nicolo-ribaudo
approved these changes
Sep 2, 2019
This was referenced Sep 17, 2019
This was referenced Oct 3, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 usingbabel-preset-typescript, which is likely the most common way of using typescript with babel.Using
babel-plugin-transform-typescriptin order to enable this on projects also requires re-implementing the TSX-handling logic that is inbabel-preset-typescript. This change will make it easier to adopt babel for existing typescript projects that use namespaces.