Skip to content

Commit

Permalink
fix(toRef): improve types overload, close #2925
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Apr 14, 2023
1 parent d142af1 commit cb6f916
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/shared/toRef/index.ts
@@ -1,4 +1,4 @@
import type { Ref, ToRef } from 'vue-demi'
import type { ComputedRef, Ref, ToRef } from 'vue-demi'
import {
customRef,
readonly,
Expand All @@ -12,6 +12,8 @@ import { noop } from '../utils'
/**
* Normalize value/ref/getter to `ref` or `computed`.
*/
export function toRef<T>(r: () => T): Readonly<Ref<T>>
export function toRef<T>(r: ComputedRef<T>): ComputedRef<T>
export function toRef<T>(r: MaybeRefOrGetter<T>): Ref<T>
export function toRef<T>(r: T): Ref<T>
export function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>
Expand Down

0 comments on commit cb6f916

Please sign in to comment.