-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bidirectional references and typing #658
Comments
I tried, but TypeScript really doesn't seem to be able to make sense of stuff anymore as soon as the type definitoins become bidirectional :-(. |
Maybe we should ask Typescript authors to improve that? If |
UPDT: Just found nice workaround here - set |
That's actually on the docs :) |
Docs have not ‘any’, but IAnyModelType (with typo), and TS complains that Node is not IAnyModelType instance.
‘any' works much better.
|
will change the docs to any then, thanks! |
Btw, the same trick can be done for bidirectional refs (only needs to be done in one of the sides though) |
@xaviergonz My fault, IAnyModelType also works, I just tried to use |
changed back :) |
I have two models that reference each other:
I have followed the example of #417 and explicitly defined interfaces for the references however in that example you have to explicitly type your entire model (ie: the example property is not available in Node). Is there another alternative besides defining a model with references and one without and composing them together as in above?
The text was updated successfully, but these errors were encountered: