I created a custom typescript definition file (brat.d.ts)
export declare class head {
ready(callback: () => any);
}
export declare class Util {
static embed(divId: string, collData: any, docData: any, webFontsURLs: Array<string>);
}
I am importing the above definition file in Angular 7 components like this
import {head, Util} from "../../brat/brat";
When I do ng serve, I get following error
'ERROR in ./src/app/folder-mgmt/list-documents/list-documents.component.ts Module not found: Error: Can't resolve '../../brat/brat' in '\src\app\folder-mgmt\list-documents'`
Can anyone please suggest what am i doing wrong
In order to solve this problem I did following
I removed export from my custom typescript definition file (brat.d.ts) file and changed it to
declare class head {
static ready(callback: () => any);
}
declare class Util {
static embed(divId: string, collData: any, docData: any, webFontsURLs: Array<string>);
}
Angular project created using Angular CLI have tsconfig.json file in the root folder of project.
I added the path of folder containing custom definition file inside "typeRoots" property of "compilerOptions" present in tsconfig.json.
In the Angular component I removed import statements for importing custom typescript definition file ("brat.d.ts" in my case)