Skip to content

Commit

Permalink
types(reactivity-transform): improve type readability for reactive va…
Browse files Browse the repository at this point in the history
…riables
  • Loading branch information
yyx990803 committed May 7, 2022
1 parent 292ce69 commit 0683a02
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions packages/vue/macros.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,21 @@ export declare const enum RefTypes {
WritableComputedRef = 3
}

type RefValue<T> = T extends null | undefined
? T
: T & { [RefType]?: RefTypes.Ref }
type RefValue<T> = T extends null | undefined ? T : ReactiveVariable<T>

type ComputedRefValue<T> = T extends null | undefined
? T
: T & { [RefType]?: RefTypes.ComputedRef }
type ReactiveVariable<T> = T & { [RefType]?: RefTypes.Ref }

type ComputedRefValue<T> = T extends null | undefined ? T : ComputedVariable<T>

type ComputedVariable<T> = T & { [RefType]?: RefTypes.ComputedRef }

type WritableComputedRefValue<T> = T extends null | undefined
? T
: T & { [RefType]?: RefTypes.WritableComputedRef }
: WritableComputedVariable<T>

type WritableComputedVariable<T> = T & {
[RefType]?: RefTypes.WritableComputedRef
}

type NormalObject<T extends object> = T & { [RefType]?: never }

Expand Down

0 comments on commit 0683a02

Please sign in to comment.