-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
TsImportEquals causes program to be considered a module. Should it? #9694
Comments
I think probably this one is not worth fixing given this stuff is legacy? I can compute if a program is actually a script another way |
@swc-project/core-es Do you have any opinion? We would only need to check for |
We have already handled a similar issue However, this time it needs to be processed in the parser. Technically speaking, In SWC, a |
There is a special case that complicates the issue. |
The prescence of a TsImportEquals causes a script to be considered a module.
Playground link (notice source type is "unknown" and the AST shows as "module" instead of "script"):
https://play.swc.rs/?version=1.7.40&code=H4sIAAAAAAAAA8vMLcgvKlEoSS0uUbBVKEotLM0sStVQSixOSVPStOblAgBnhfLXIAAAAA%3D%3D&config=H4sIAAAAAAAAA1WQMW7DMAxF95zC4BzUhcesLbJ16gkEhW6USqRAUmiNwHev5MRxupHv8%2FODvO66Di7q4dBda1mb7ERRHn0lOpG530rApozqJWSD%2FaqaNsmk4ELmmwDm5AutmVCH12GAlYsjHVnSc0JRfMcxEB5Z3qJTPQaMJ73vfUQJOm9PvopCyiz2yUU8trCzWdZD36OmFz33%2BWbZbwYpZCEts64YJ2fBw12e%2F10QmbXNjS5qu23hkPhUIm7vai9pyzynxHRR2CYDhXFaFywo6Mdqh0LfxD8Eu%2FkPEPbTUoQBAAA%3D
Is this expected behaviour? I understand that TsImportEquals are only included in the
ModuleDecl
enum.The text was updated successfully, but these errors were encountered: