$fromRefs is not returning UnwrapRef type
Version
3.2.4
Reproduction link
None
Steps to reproduce
<script lang="ts" setup>
import { toRefs } from 'vue';
const props = defineProps({
isDisabled: {
type: Boolean,
default: false,
},
style: {
type: String,
default: 'primary',
},
});
const { style } = $fromRefs(toRefs(props));
console.log(style); // correct output (primary) but incorrect type (Ref<string>)
</script>
What is expected?
I am expecting the type to unwrap the refs from toRefs(props)
What is actually happening?
The
// The type for `$fromRefs` is
ShallowUnwrapRef<ToRefs<Readonly<{
isDisabled?: unknown;
style?: unknown;
} & {
isDisabled: boolean;
style: string;
} & {}>>>
// The type for `style` is
Ref<string>
I am expecting it to be a string
:thinking:
Is this correct behavior of the type or am I just missing something here?