Subscribe on changes!

'state' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.

avatar
Jun 29th 2022

Vue version

3.0.0

Link to minimal reproduction

//

Steps to reproduce

  1. type State = { isSelf?: ComputedRef; };

  2. const state = reactive({ form: { authRelation: 2 }, isSelf: computed(() => { return state.form?.authRelation == 2; }), }); 3.yarn serve

but: below is ok

const state = reactive({ form: { authRelation: 2 }, isSelf: computed((): boolean => { return state.form?.authRelation == 2; }), });

What is expected?

sucessed

What is actually happening?

yes

System Info

No response

Any additional comments?

No response

avatar
Jun 29th 2022

Hello @xiaoyongchen

Thank your for your interest in this project.

However, your issue is a usage/support question, and the issue tracker is reserved exclusively for bug reports and feature requests (as outlined in our Contributing Guide).

We encourage you to ask it on Discord chat or Stack Overflow or on our and are happy to help you out there.


computed's needs to be annotated here as aotherwise, the type of state is circular and therfore not inferrable for TS.