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
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/11436/ |
jsxPragma, | ||
allExtensions = false, | ||
isTSX = false, | ||
allowNamespaces = false, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, done 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
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-typescript
in 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.