Skip to content

Commit

Permalink
fix(types): fix shallowRef type error
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfred-Skyblue committed Dec 15, 2023
1 parent 305e4ae commit 7da94ea
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/v3/reactivity/ref.ts
Expand Up @@ -51,9 +51,13 @@ declare const ShallowRefMarker: unique symbol

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

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>(
value: T
): Ref extends T
? T extends Ref
? IfAny<T, ShallowRef<T>, T>
: ShallowRef<T>
: ShallowRef<T>
export function shallowRef<T = any>(): ShallowRef<T | undefined>
export function shallowRef(value?: unknown) {
return createRef(value, true)
Expand Down

0 comments on commit 7da94ea

Please sign in to comment.