types: fix ref unwrapping when nested inside arrays (#331)

This commit is contained in:
扩散性百万甜面包
2019-10-19 02:54:05 +08:00
committed by Evan You
parent 58fcd15000
commit 3cd2f7e68e
2 changed files with 21 additions and 3 deletions

View File

@@ -74,7 +74,6 @@ export type UnwrapRef<T> = {
ref: T extends Ref<infer V> ? UnwrapRef<V> : T
array: T extends Array<infer V> ? Array<UnwrapRef<V>> : T
object: { [K in keyof T]: UnwrapRef<T[K]> }
stop: T
}[T extends ComputedRef<any>
? 'cRef'
: T extends Ref
@@ -82,5 +81,5 @@ export type UnwrapRef<T> = {
: T extends Array<any>
? 'array'
: T extends BailTypes
? 'stop' // bail out on types that shouldn't be unwrapped
: T extends object ? 'object' : 'stop']
? 'ref' // bail out on types that shouldn't be unwrapped
: T extends object ? 'object' : 'ref']