seniorTypeScript
Explain 'Ambient Modules' vs 'Internal Modules'.
Updated May 4, 2026
Short answer
Ambient modules describe existing JS code shapes; Internal modules (namespaces) group TS code.
Deep explanation
Ambient modules use the declare keyword to explain the shape of code not written in TS (like a .d.ts file). Internal modules are the older 'namespace' pattern for organization, now largely replaced by standard ES modules[cite: 1].
Unlock with a Pro subscription to view this section.
View pricingReal-world example
No real-world example available yet.
Unlock with a Pro subscription to view this section.
Upgrade to ProCommon mistakes
No common mistakes listed yet.
Unlock with a Pro subscription to view this section.
Upgrade to ProFollow-up questions
No follow-up questions available yet.
Unlock with a Pro subscription to view this section.
Upgrade to Pro