Open cpintos-sc opened 1 year ago
Hey @cpintos-sc - thanks for filing this issue and putting together the reproduction! Very helpful.
I think this may be related to https://github.com/mobxjs/mobx-state-tree/issues/1851 although I'm not 100% sure if it's exactly the problem.
Either way, we do know that our TypeScript updates really need to be improved. I'm not exactly sure when we'll be fixing it, but it's top of the list. Sorry for the inconvenience at the moment.
If you're interested in pitching in, we'd gladly accept some assistance. But no worries if you just wanted to let us know and hopefully we can resolve this for ya in the coming months.
I have a workaround to solve this issue.
It's declare StoreInstance by handwriting instead of use Instance
type RootStoreInstance = {
SomeStore: SomeStoreInstance
}
and use this type in getRoot<RootStoreInstance>(self)
@Anoninz workaround worked for me. Thank u.
Bug report
Sandbox link or minimal reproduction code Here is the repro
Describe the expected behavior The typings should not become any and there shouldn't be any circular reference error.
Describe the observed behavior The problem starts when using
yield
with a RootStore action within a child model. I do not have a problem getting the RootStore or even executing it's actions, it just happens when usingyield
with an async function. See line 13, 14 and 15 of theRootStore.ts
file.