What's new

Angular 8-to-9 migration (WITHOUT Material) index.d.ts module declaration problem


Active member
Staff member
I have two modules declared in an index.d.ts file like this:

declare module 'googlemaps';
declare module 'detect-resize';

This used to work just fine so that I'd be able to use these modules.

For googlemaps I have a dependency on @types/googlemaps, but the googlemaps API can't be loaded until runtime, which is done using an API key.

detect-resize is simply lacking typing, and needs the declare because of that.

Using Angular 8 and earlier, I had no problems with these modules so long as they were declared in index.d.ts. With Angular 9, that isn't fixing the problem, and I can't get through a build now.

I've found issues reported with Angular 9 and index.d.ts, but they all involve Angular Material, and solving the problem by changing the version of Material used. That's obviously not going to help here.

Anyone know a solution for this?

Continue reading...