ref<type parameters> get Ref<UnwrapRef<type parameters>>
Version
3.0.2
Reproduction link
Steps to reproduce
import { ref, Ref } from 'vue';
function useParseArgs<T>(args: Record<string, any>): Array<T> {
// const data: Ref<UnwrapRef<T>>
const data = ref<T>({} as T);
// const data1: Ref<T>. I got what I wanted here
// but ({} as Ref<T>) {} is not Ref
const data1 = ref<Ref<T>>({} as Ref<T>);
return [];
}
What is expected?
const data: Ref<T>
What is actually happening?
const data: Ref<UnwrapRef<T>>
// if T is type parameters, T extends Ref<infer V> is not valid
export declare type UnwrapRef<T> = T extends Ref<infer V> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;