This commit is contained in:
YangLGggggggggg 2025-07-01 17:51:43 +08:00 committed by GitHub
commit 5dfc327399
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -45,6 +45,8 @@ export function isRef(r: any): r is Ref {
return r ? r[ReactiveFlags.IS_REF] === true : false
}
export type TypeRef<T> = Ref<UnwrapRef<T>, UnwrapRef<T> | T>
/**
* Takes an inner value and returns a reactive and mutable ref object, which
* has a single property `.value` that points to the inner value.
@ -54,7 +56,7 @@ export function isRef(r: any): r is Ref {
*/
export function ref<T>(
value: T,
): [T] extends [Ref] ? IfAny<T, Ref<T>, T> : Ref<UnwrapRef<T>, UnwrapRef<T> | T>
): [T] extends [Ref] ? IfAny<T, Ref<T>, T> : TypeRef<T>
export function ref<T = any>(): Ref<T | undefined>
export function ref(value?: unknown) {
return createRef(value, false)