Skip to content
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

the name default is exported multiple times in global declaration file #5362

Closed
MarvelSQ opened this issue Aug 2, 2022 · 2 comments · Fixed by #5363
Closed

the name default is exported multiple times in global declaration file #5362

MarvelSQ opened this issue Aug 2, 2022 · 2 comments · Fixed by #5363
Labels
Milestone

Comments

@MarvelSQ
Copy link

MarvelSQ commented Aug 2, 2022

Describe the bug

in global declaration file, where declare multiple modules

Input code

declare module 'a' {
    const Component: any;
    export default Component;
}

declare module 'b' {
    const Component: any;
    export default Component;
}

Config

{
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "tsx": false
    },
    "target": "es5",
    "loose": false,
    "minify": {
      "compress": false,
      "mangle": false
    }
  },
  "module": {
    "type": "es6"
  },
  "minify": false,
  "isModule": true
}

Playground link

https://play.swc.rs/?version=1.2.222&code=H4sIAAAAAAAAA0tJTc5JLEpVyM1PKc1JVVBPVFeo5lIAguT8vOISBef83IL8vNS8EiuFxLxKa7BMakVBflGJQkpqWmJpDpISa65aLq4UNPOSKDIPADGKN8ueAAAA&config=H4sIAAAAAAAAA0WNSwrDMAxE76J1ts0id%2BghjKsEF%2F%2FQKBBjfPfawSU7aebpqdIXlrZK2QhYxoQS1Vy0kZbMsOKy0kKKHu3Gg1tfjBysHWG8eudTAs92oeCi28sw2RSyMPBUJh7%2BT7YuCulzjqDez27hSu1xzDuH9wRVTm4%2FOkwQUrUAAAA%3D

Expected behavior

no error report

Actual behavior

  x the name `default` is exported multiple times
   ,-[input.ts:3:5]
 3 | export default Component;
   : ^^^^^^^^^^^^|^^^^^^^^^^^^
   :             `-- previous exported here
 4 | }
 5 | 
 6 | declare module 'b' {
 7 |     const Component: any;
 8 |     export default Component;
   :     ^^^^^^^^^^^^|^^^^^^^^^^^^
   :                 `-- exported more than once
   `----

Error: 
  > Exported identifiers must be unique

Version

1.2.222

Additional context

No response

@MarvelSQ MarvelSQ added the C-bug label Aug 2, 2022
@MarvelSQ MarvelSQ changed the title the name default is exported multiple times in global declaration file the name **default** is exported multiple times in global declaration file Aug 2, 2022
@kdy1 kdy1 added this to the Planned milestone Aug 2, 2022
@MarvelSQ MarvelSQ changed the title the name **default** is exported multiple times in global declaration file the name default is exported multiple times in global declaration file Aug 2, 2022
@magic-akari
Copy link
Member

Yes, We should never touch anything in declare module block.
#5316 (comment)

@swc-bot
Copy link
Collaborator

swc-bot commented Oct 16, 2022

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.

@swc-project swc-project locked as resolved and limited conversation to collaborators Oct 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

4 participants