From: Evan You Date: Sat, 7 May 2022 02:37:07 +0000 (+0800) Subject: types(reactivity-transform): improve type readability for reactive variables X-Git-Tag: v3.2.34-beta.1~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0683a022ec83694e29636f64aaf3c04012e9a7f0;p=thirdparty%2Fvuejs%2Fcore.git types(reactivity-transform): improve type readability for reactive variables --- diff --git a/packages/vue/macros.d.ts b/packages/vue/macros.d.ts index a0a9f54d30..41aefd77d7 100644 --- a/packages/vue/macros.d.ts +++ b/packages/vue/macros.d.ts @@ -16,17 +16,21 @@ export declare const enum RefTypes { WritableComputedRef = 3 } -type RefValue = T extends null | undefined - ? T - : T & { [RefType]?: RefTypes.Ref } +type RefValue = T extends null | undefined ? T : ReactiveVariable -type ComputedRefValue = T extends null | undefined - ? T - : T & { [RefType]?: RefTypes.ComputedRef } +type ReactiveVariable = T & { [RefType]?: RefTypes.Ref } + +type ComputedRefValue = T extends null | undefined ? T : ComputedVariable + +type ComputedVariable = T & { [RefType]?: RefTypes.ComputedRef } type WritableComputedRefValue = T extends null | undefined ? T - : T & { [RefType]?: RefTypes.WritableComputedRef } + : WritableComputedVariable + +type WritableComputedVariable = T & { + [RefType]?: RefTypes.WritableComputedRef +} type NormalObject = T & { [RefType]?: never }