Issue
This might be something basic, but I am a beginner, and a colleague who doesn't work with me anymore left something in the code which behaves differently.
I have 4 interfaces.ts files below
1. interfaces.ts
interface Pro{
id: number;
title: string;
}
2. interfaces.ts
interface Tar{
id: number;
title: string;
pros: Pro[];
}
As you can see Tar uses an array of Pro-s. Works fine
3. interfaces.ts
export interface Pay{
id: number;
title: string;
}
4. interfaces.ts
interface Prm{
id: number;
title: string;
pays: Pay[];
}
The editor is adding red underline under this last line (pays: Pay[];) saying cannot find name 'Pay'. The suggested fix is an import { Pay } , but that is something that was not needed when we used 1 in 2. Using 3 in 4 might not work because of the "export interface" ?
If I am using the suggested fix, then the whole module 4 (prm) looks like it is braking the whole project, ng build crashes in 50 places
I am not sure what to change, as the guy who made the whole module 3 and interface, made this one different than all the rest of the modules.
thank you
Solution
So basically what I did was
add export to the Prm too
add import { Pay } '...' at the beginning
This snowballed into crashing everywhere, where Prm was used. So I have to decide if I will use export everywhere, or nowhere.
Answered By - Dude
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.