I've tried everything here, but for me it was a completely different issue:
I had to remove from my *.d.ts
any import statements:
import { SomeModuleType } from '3rd-party-module';
After removing the error went away...
Clarification:
When we declare a module in a *.d.ts
file, it's automatically picked up by the Typescript compiler as an ambient module (the one you don't need to import explicitly). Once we specify the import ... from ...
, the file now becomes a normal (ES6) module, and hence won't be picked up automatically. Hence if you still want it to behave as an ambient module, use a different import style like so:
type MyType: import('3rd-party-module').SomeModuleType;