-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[Bug]: Incorrect print result of TSModuleDeclaration #16513
Comments
Hey @qbx2! 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. |
The two syntaxes are equivalent (like choosing to use single vs double quotes in strings), and |
@nicolo-ribaudo In old TypeScript, you might be right. However in the latest TypeScript, 'module' is not deprecated and different from namespace. |
From https://www.typescriptlang.org/docs/handbook/namespaces.html ,
It seems that you’re talking that ’internal module’ is deprecated but I’m talking that babel rewrites ‘external module’ to ‘namespace (internal module)’ |
The difference of two is: ‘module’ won’t be shared across files. Unlike ‘module’, ‘namespace’ can be shared across files if the name is equivalent. Therefore, it can lead to a name conflict to rewrite module to namespace. |
"external modules" are when you write From the docs you quoted: "(namely that module X { is equivalent to the now-preferred namespace X {)." |
@nicolo-ribaudo Oh, there was my misunderstanding. Thank you for the clarification. |
💻
How are you using Babel?
Programmatic API (
babel.transform
,babel.parse
)Input code
Configuration file name
No response
Configuration
No response
Current and expected behavior
Current behavior:
Expected behavior:
Environment
System:
OS: macOS 14.1.1
Binaries:
Node: 18.17.0 - ~/Library/Caches/fnm_multishells/19593_1715933137130/bin/node
Yarn: 1.22.17 - /opt/homebrew/bin/yarn
npm: 9.6.7 - ~/Library/Caches/fnm_multishells/19593_1715933137130/bin/npm
pnpm: 8.13.1 - ~/Library/Caches/fnm_multishells/19593_1715933137130/bin/pnpm
npmPackages:
@babel/generator: ^7.24.5 => 7.24.5
@babel/parser: ^7.24.5 => 7.24.5
@babel/types: ^7.24.5 => 7.24.5
Possible solution
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: