From: Jooger Date: Sat, 12 Oct 2019 15:05:34 +0000 (+0800) Subject: types(reactivity): fix ref typing (#239) X-Git-Tag: v3.0.0-alpha.0~471 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=675ce2c15d5aa3587f0d090a0a3272abdd27cceb;p=thirdparty%2Fvuejs%2Fcore.git types(reactivity): fix ref typing (#239) --- 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 {