diff --git a/packages/dts-test/ref.test-d.ts b/packages/dts-test/ref.test-d.ts index f66ff9269..62bad77c2 100644 --- a/packages/dts-test/ref.test-d.ts +++ b/packages/dts-test/ref.test-d.ts @@ -163,6 +163,17 @@ const state = reactive({ expectType(state.foo.label) +describe('ref with generic', () => { + const r = {} as T + const s = ref(r) + expectType(s.value.name) + + const rr = {} as MaybeRef + // should at least allow casting + const ss = ref(rr) as Ref + expectType(ss.value.name) +}) + // shallowRef type Status = 'initial' | 'ready' | 'invalidating' const shallowStatus = shallowRef('initial') @@ -206,6 +217,11 @@ describe('shallowRef with generic', () => { const s = shallowRef(r) expectType(s.value.name) expectType>(shallowRef(r)) + + const rr = {} as MaybeRef + // should at least allow casting + const ss = shallowRef(rr) as Ref | ShallowRef + expectType(ss.value.name) }) {