Skip to content

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

@MarvelSQ

Description

@MarvelSQ

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions