Recursive References in TypeScript
I'm stuck with a very specific TS/JS problem, which may not be solvable but I thought I'd see if anyone here has a cool idea on how to solve it.
So I have a file
index.ts
with a mapping from some keys to objects:
Then, in the files that contain the objects, they may refer to each other, e.g. in a.ts
I may have:
Currently with this setup, I get __WEBPACK_DEFAULT_EXPORT__
and Cannot access 'B' before initialization
errors.1 Reply
I think the main problem here is that I have circular references across files, where A requires B where B may require A
It seems as though as long as there's not a circular import to the root, e.g. A -> index -> B -> A its fine