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
I hope this code can pass type checking in both Vue 3.3 and Vue 3.2.
What is actually happening?
src/App.vue:15:3 - error TS2741: Property 'effect' is missing in type 'Ref<number>' but required in type 'WritableComputedRef<number>'.
15 value: count,
~~~~~
node_modules/@vue/reactivity/dist/reactivity.d.ts:281:14
281 readonly effect: ReactiveEffect<T>;
~~~~~~
'effect' is declared here.
src/App.vue:3:3
3 value: WritableComputedRef<number>;
~~~~~
The expected type comes from property 'value' which is declared here on type '{ value: WritableComputedRef<number>; }'
Found 1 error in src/App.vue:15
System Info
No response
Any additional comments?
I'm not sure if this was intended, if so please close this issue.
The text was updated successfully, but these errors were encountered:
Mini-ghost
changed the title
The types in Vue 3.3.0-beta.3 are inconsistent with those in Vue 3.2.47.
Type 'Ref<any> | WritableComputedRef<any>' is not assignable to type 'WritableComputedRef<any>' in Vue 3.3.0-beta.3
May 4, 2023
This should be considered intended behavior - the previous provide() types were not strict enough and allowing incompatible types to be provided. After the change it is now correctly catching type errors that should be fixed.
In your case, you are indicating that you are providing a WritableComputedRef but actually providing a Ref. The two types are indeed in compatible.
Vue version
3.3.0-beta.3
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-eyefe5?file=src%2FApp.vue&terminal=dev
Steps to reproduce
The code, which undergoes type checking (via
vue-tsc
) in Vue 3.3.0-beta.3, will produce an error, whereas it will pass in Vue 3.2.47.npm run typecheck
What is expected?
I hope this code can pass type checking in both Vue 3.3 and Vue 3.2.
What is actually happening?
System Info
No response
Any additional comments?
I'm not sure if this was intended, if so please close this issue.
The text was updated successfully, but these errors were encountered: