Skip to content

docs: clarify export {} comment in global-modifying-module templates Improvements: #3410 (Issue) #3414

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

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from

Conversation

ishantmishra03
Copy link

docs: clarify export {} comment in global-modifying-module template ( #3410 )

Related Issue

Closes #3410

Summary

This PR improves the comment in the global-modifying-module-d-ts declaration file template by providing a clearer explanation of why the export {} line is necessary when the module exports nothing.

Problem

The original comment was:

/*~ If your module exports nothing, you'll need this line. Otherwise, delete it */
export {};

Changes Made

  • Expanded the comment to clarify that export {} ensures TypeScript treats the file as a module.

  • Explained the consequences of omitting the line (e.g., leaking declarations to the global scope, causing identifier conflicts).

  • Included an official link to the TypeScript Handbook on module code organization.

New Updated looks like :

now

Notes

-- This change is documentation-only and has no impact on runtime behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Why do you have to export something in a declaration file to define things in the global scope?
1 participant