Discuss 'Module Augmentation' vs 'Global Augmentation'.

Updated May 4, 2026

Short answer

Module augmentation extends a specific third-party module, while global augmentation extends the global namespace (like Window).

Deep explanation

TypeScript's declaration merging allows you to add members to existing interfaces. Module augmentation is used when you want to add a method to a library like 'Express' or 'Knex'. You wrap the interface in a declare module 'library-name' block. Global augmentation is used for browser-wide or process-wide objects like process.env or Document. This is essential for maintaining type safety when using middlewares or polyfills that modify external objects.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More TypeScript interview questions

View all →