- Notifications
You must be signed in to change notification settings - Fork638
Typescript Circular properties causing typed Any#1879
-
Hi! I am trying to develop some type of Folder structures where I defined these three entities:
The problem that I am seeing is the circular dependency here is causing I appreciate the help! |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 1 comment
-
I don't see an obvious solution in your example, butthis part of the documentation andthis neat trick by kresli might give some inspiration. import{IAnyModelType,Instance,types}from"mobx-state-tree";constNode=types.model({x:5,me:types.maybe(types.late(():IAnyModelType=>Node))}).views((self)=>({getMe(){returnself.measInstance<typeofself>|undefined;}}));constnode=Node.create({x:5,me:{x:4}});constme=node.getMe();// Works!me?.x// Property 'y' does not exist on type...me?.y |
BetaWas this translation helpful?Give feedback.