Skip to content

Commit bf0cbde

Browse files
test(shallowRef): add test case
1 parent fdbda1a commit bf0cbde

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/dts-test/ref.test-d.ts

+10
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,16 @@ describe('shallowRef with generic', <T extends { name: string }>() => {
208208
expectType<ShallowRef<T>>(shallowRef(r))
209209
})
210210

211+
{
212+
// should return ShallowRef<T> | Ref<T>, not ShallowRef<T | Ref<T>>
213+
expectType<ShallowRef<{ name: string }> | Ref<{ name: string }>>(
214+
shallowRef({} as MaybeRef<{ name: string }>)
215+
)
216+
expectType<ShallowRef<number> | Ref<string[]> | ShallowRef<string>>(
217+
shallowRef('' as Ref<string[]> | string | number)
218+
)
219+
}
220+
211221
// proxyRefs: should return `reactive` directly
212222
const r1 = reactive({
213223
k: 'v'

0 commit comments

Comments
 (0)