You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
property circularly references on destructing objects but working properly without destructing #40279
BTW, destructing inside the function also works. Are there any differences? In my opinion, they are the same thing.
constfoo=create<Root>()({state: {bar: 1},// effects: (dispatch) => {// // worked without destructing dispatch// console.log(dispatch.foo.state.bar);// },// effects: ({ foo }) => {// // failed with destructing// console.log(foo.state.bar);// },effects: (dispatch)=>{// it also worked while destructing inside the function, any difference here?const{ foo }=dispatch;console.log(foo.state.bar);},})
Activity
tianzhich commentedon Aug 27, 2020
When using
foodirectly, not from param. This error trigged in v3.8.3 and its previous versions. But after this like v3.9.2, it was fixed.So I think there should no cycle reference errors when referencing the
fooinside its initializer no matter from itself or function params.tianzhich commentedon Sep 4, 2020
BTW, destructing inside the function also works. Are there any differences? In my opinion, they are the same thing.
RyanCavanaugh commentedon Sep 9, 2020
These are different constructs and have different implications on type inference; in the destructuring case a circularity is in fact occurring
semoal commentedon Sep 9, 2020
So, isnt there any "workaround" to handle this?
tianzhich commentedon Sep 10, 2020
I do not understand well. But destructing param immediately or inside the function both worked with pure js. Is any workaround here?
typescript-bot commentedon Sep 12, 2020
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.