error TS2668: ‘export’ modifier cannot be applied to ambient modules and module augmentations since they are always visible.
To describe the shape of libraries not written in TypeScript, we need to declare the API that the library exposes. We call declarations that don’t define an implementation “ambient”. Typically, these are defined in
.d.ts files. If you’re familiar with C/C++, you can think of these as
With module augmentation, users have the ability to extend existing modules such that consumers can specify if they want to import the whole module or just a subset.
Broken Code ❌
Fixed Code ✔️