I am developing a react app with typescript. In the problem I am facing, there are 2 separate interfaces and one component class that these interfaces are imported. The problem is that when the app is run, the component class attempt to import both interfaces sequentially, however, the interfaces also imports each other which causes cyclic error-prone behavior and lead app to crash with TypeError: object prototype may only be an object or null: undefined.
I put the sample code below. Moreover, I am not able to modify the data model which are fields within the interfaces. Any help are welcomed.
import {B} from "../../some/path";
import {C} from "../some/other/path";
export interface A {
field1: B,
field2: C
}
import {A} from "../../other/path";
import {D} from "../some/other/path";
export interface B {
field1: A,
field2: D
}
import {A} from "../../other/path"
import {B} from "../some/path"
export class TEST extend React.Component<>{
this.inputEntity1: A;
this.inputEntity2: B;
}
Note: All interfaces and the class are located different files.