Skip to content

No error when exporting from global augmentations #64152

Description

If you export a binding from the global scope, you're supposed to get an error unless you create a local binding and export it with whatever name you want.

export { Math };
//       ~~~~
// Cannot export 'Math'. Only local declarations can be exported from a module.

However, we have a hole and allow exports that originate from a global augmentation. The following file is permitted with no error:

declare global {
    var XYZ: number;
}

export { XYZ };

Playground Link

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions