- What works =>
I have a index.d.ts file in my app root where I have global things declared for example global modules.
So my index.d.ts looks like following:
declare module 'moment';
and I can import moment in any .ts file without any error.
- Where problem arises =>
Now problem arises when I import something in my index.d.ts file to make more declarations. Lets say my as follows:
import { MyService } from './path/to/file'; //line#1
declare module 'moment';
export interface SomeInterface {
name: string;
salary: number;
myService: MyService
}
Now any imports in my .ts file that were importing moment are erroneous and throw Cannot find module 'moment'.ts(2307)
As soon as I comment line#1, the moment imports start working again.
What am I doing wrong here?