Skip to content

Explain declare global details | Feature: #3409 #3415

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 2 commits into
base: v2
Choose a base branch
from

Conversation

ishantmishra03
Copy link

@ishantmishra03 ishantmishra03 commented Jul 12, 2025

docs: add detailed explanation of declare global statement ( #3409 )

Related Issue

Addresses the need for clearer explanation of declare global as noted in discussion (e.g., #3409)

Summary

This PR adds a dedicated section to the "By Example" declaration files documentation explaining:

  • What declare global does
  • Why it is necessary inside modules
  • When and how to use it for global augmentation
  • Importance of marking the file as a module with export {}

This clarifies a common confusion point for TypeScript declaration authors.

Changes

  • Added a new section after "Global Functions" titled The declare global Statement
  • Included example code and detailed explanation
  • Added links to official handbook references

Updated :

Screenshot 2025-07-12 143842 Screenshot 2025-07-12 143859

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

@ishantmishra03
Copy link
Author

@microsoft-github-policy-service agree

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.

1 participant