|
|
@@ -41,6 +41,23 @@ function plainType(arg: number | Ref<number>) {
|
|
|
expectType<Ref<IteratorFoo | null | undefined>>(
|
|
|
ref<IteratorFoo | null | undefined>()
|
|
|
)
|
|
|
+
|
|
|
+ // should not unwrap ref inside arrays
|
|
|
+ const arr = ref([1, new Map<string, any>(), ref('1')]).value
|
|
|
+ const value = arr[0]
|
|
|
+ if (isRef(value)) {
|
|
|
+ expectType<Ref>(value)
|
|
|
+ } else if (typeof value === 'number') {
|
|
|
+ expectType<number>(value)
|
|
|
+ } else {
|
|
|
+ // should narrow down to Map type
|
|
|
+ // and not contain any Ref type
|
|
|
+ expectType<Map<string, any>>(value)
|
|
|
+ }
|
|
|
+
|
|
|
+ // should still unwrap in objects nested in arrays
|
|
|
+ const arr2 = ref([{ a: ref(1) }]).value
|
|
|
+ expectType<number>(arr2[0].a)
|
|
|
}
|
|
|
|
|
|
plainType(1)
|