Skip to content

Commit

Permalink
refactor(types): simplified UnwrapRef (#1390)
Browse files Browse the repository at this point in the history
  • Loading branch information
Picknight authored Jun 17, 2020
1 parent 04751ff commit 8899a90
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/reactivity/src/ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { track, trigger } from './effect'
import { TrackOpTypes, TriggerOpTypes } from './operations'
import { isObject, hasChanged } from '@vue/shared'
import { reactive, isProxy, toRaw } from './reactive'
import { ComputedRef } from './computed'
import { CollectionTypes } from './collectionHandlers'

declare const RefSymbol: unique symbol
Expand Down Expand Up @@ -157,9 +156,9 @@ type BaseTypes = string | number | boolean
*/
export interface RefUnwrapBailTypes {}

export type UnwrapRef<T> = T extends ComputedRef<infer V>
export type UnwrapRef<T> = T extends Ref<infer V>
? UnwrapRefSimple<V>
: T extends Ref<infer V> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>
: UnwrapRefSimple<T>

type UnwrapRefSimple<T> = T extends
| Function
Expand Down

0 comments on commit 8899a90

Please sign in to comment.