Skip to content

Commit

Permalink
Update ref.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Dec 6, 2023
1 parent 1de486c commit a987bc1
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/v3/reactivity/ref.ts
Expand Up @@ -40,9 +40,7 @@ export function isRef(r: any): r is Ref {
return !!(r && (r as Ref).__v_isRef === true)
}

export function ref<T extends object>(
value: T
): [T] extends [Ref] ? T : Ref<UnwrapRef<T>>
export function ref<T extends Ref>(value: T): T
export function ref<T>(value: T): Ref<UnwrapRef<T>>
export function ref<T = any>(): Ref<T | undefined>
export function ref(value?: unknown) {
Expand All @@ -53,9 +51,8 @@ declare const ShallowRefMarker: unique symbol

export type ShallowRef<T = any> = Ref<T> & { [ShallowRefMarker]?: true }

export function shallowRef<T extends object>(
value: T
): [T] extends [Ref] ? T : ShallowRef<T>
export function shallowRef<T>(value: T | Ref<T>): Ref<T> | ShallowRef<T>
export function shallowRef<T extends Ref>(value: T): T
export function shallowRef<T>(value: T): ShallowRef<T>
export function shallowRef<T = any>(): ShallowRef<T | undefined>
export function shallowRef(value?: unknown) {
Expand Down

0 comments on commit a987bc1

Please sign in to comment.