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 'Namespace' not works #966
Comments
Isn't this a bug? Or is this spec not going to be implemented soon? I'm looking forward to applying this awesome library to my project 👍 |
It a feature which can't be supported by swc, but can be by spack. Side note: Implementation will be easy |
Thank you for your answer 👍 May I ask why swc can't support this? In my opinion, swc is a typescript compiler, Is it a design or technical issue of swc? Or doesn't it fit the purpose of swc? |
swc (and babel) works by file-by-file manner and namespace support (and const enums) requires reading multiple files. Hmm... I noticed that it can supported if swc accepts a list of files or directory names. There is a lint about it. https://palantir.github.io/tslint/rules/no-namespace/ |
I don't think all use of namespaces is discouraged. But like Java's inner class, The namespace is not deprecated. It's also because typescript doesn't want to remove the existing spec, |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Describe the bug
If I write code using the
namespace
spec in typescript, it is removed after transpiling.handbook document link
Namespace should be able to have
export function
orexport const variable
, and etc..And it can have runtime behavior.
Input code
Config
Expected behavior
Output of the same code compiled with tsc: typescript playground
and swc:
Version
The version of @swc/core:
1.2.19
Additional context
The text was updated successfully, but these errors were encountered: