From 675ce2c15d5aa3587f0d090a0a3272abdd27cceb Mon Sep 17 00:00:00 2001 From: Jooger Date: Sat, 12 Oct 2019 23:05:34 +0800 Subject: [PATCH] types(reactivity): fix ref typing (#239) --- packages/reactivity/src/ref.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/reactivity/src/ref.ts b/packages/reactivity/src/ref.ts index 3616799e36..234a638b79 100644 --- a/packages/reactivity/src/ref.ts +++ b/packages/reactivity/src/ref.ts @@ -12,7 +12,9 @@ export interface Ref { const convert = (val: any): any => (isObject(val) ? reactive(val) : val) -export function ref(raw: T): Ref { +export function ref(raw: T): T +export function ref(raw: T): Ref +export function ref(raw: any) { if (isRef(raw)) { return raw } @@ -28,7 +30,7 @@ export function ref(raw: T): Ref { trigger(v, OperationTypes.SET, '') } } - return v as Ref + return v as Ref } export function isRef(v: any): v is Ref { -- 2.47.3