-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Open
Labels
🍰 p2-nice-to-havePriority 2: this is not breaking anything but nice to have it addressed.Priority 2: this is not breaking anything but nice to have it addressed.✨ feature requestNew feature or requestNew feature or requestscope: types
Description
Version
3.0.0-rc.7
Reproduction link
https://codesandbox.io/s/stupefied-beaver-500yq?file=/src/test.ts:0-404
Steps to reproduce
Write the following, reasonably minimal code.
import { reactive, ComputedRef } from "vue";
interface Foo {
position: number;
}
interface Bar {
position: number;
callback: (data: any) => void;
}
function createStuff(name: string, position: ComputedRef<number>) {
const a: Foo = reactive({
position: position,
});
const b: Bar = reactive({
position: position, // Issue happens here
callback: (v) => {},
});
}What is expected?
That the types are inferred correctly.
What is actually happening?
In the Bar case, Typescript complains about Type 'ComputedRef<number>' is not assignable to type 'number'. In the Foo case, everything works as expected.
This might as well be a bug with Typescript, but considering that it affects Vue's reactive API due to the automatic ref unwrapping, I thought I'd open it here first.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
🍰 p2-nice-to-havePriority 2: this is not breaking anything but nice to have it addressed.Priority 2: this is not breaking anything but nice to have it addressed.✨ feature requestNew feature or requestNew feature or requestscope: types