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 42942e9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/v3/reactivity/ref.ts
Original file line number Diff line number Diff line change
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
): 1 extends (T extends Ref ? 1 : 0)
? 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 42942e9

Please sign in to comment.