types(reactivity-transform): improve type readability for reactive variables
This commit is contained in:
parent
292ce69439
commit
0683a022ec
18
packages/vue/macros.d.ts
vendored
18
packages/vue/macros.d.ts
vendored
@ -16,17 +16,21 @@ export declare const enum RefTypes {
|
|||||||
WritableComputedRef = 3
|
WritableComputedRef = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
type RefValue<T> = T extends null | undefined
|
type RefValue<T> = T extends null | undefined ? T : ReactiveVariable<T>
|
||||||
? T
|
|
||||||
: T & { [RefType]?: RefTypes.Ref }
|
|
||||||
|
|
||||||
type ComputedRefValue<T> = T extends null | undefined
|
type ReactiveVariable<T> = T & { [RefType]?: RefTypes.Ref }
|
||||||
? T
|
|
||||||
: T & { [RefType]?: RefTypes.ComputedRef }
|
type ComputedRefValue<T> = T extends null | undefined ? T : ComputedVariable<T>
|
||||||
|
|
||||||
|
type ComputedVariable<T> = T & { [RefType]?: RefTypes.ComputedRef }
|
||||||
|
|
||||||
type WritableComputedRefValue<T> = T extends null | undefined
|
type WritableComputedRefValue<T> = T extends null | undefined
|
||||||
? T
|
? T
|
||||||
: T & { [RefType]?: RefTypes.WritableComputedRef }
|
: WritableComputedVariable<T>
|
||||||
|
|
||||||
|
type WritableComputedVariable<T> = T & {
|
||||||
|
[RefType]?: RefTypes.WritableComputedRef
|
||||||
|
}
|
||||||
|
|
||||||
type NormalObject<T extends object> = T & { [RefType]?: never }
|
type NormalObject<T extends object> = T & { [RefType]?: never }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user