@@ -13,9 +13,10 @@ import {
1313 markRaw ,
1414 shallowReadonly ,
1515 set ,
16- del
16+ del ,
17+ ShallowRef
1718} from '../../index'
18- import { IsUnion , describe , expectType } from '../utils'
19+ import { IsUnion , describe , expectType , expectError } from '../utils'
1920
2021function plainType ( arg : number | Ref < number > ) {
2122 // ref coercing
@@ -163,6 +164,13 @@ if (shallowStatus.value === 'initial') {
163164 shallowStatus . value = 'invalidating'
164165}
165166
167+ expectType < ShallowRef < number > > ( shallowRef ( 1 ) )
168+ expectType < ShallowRef < { name : string } | Ref < { name : string } > > > (
169+ shallowRef ( { } as { name : string } | Ref < { name : string } > )
170+ )
171+ expectType < Ref < string > > ( shallowRef ( ref ( 'foo' ) ) )
172+ expectType < ShallowRef < string > > ( shallowRef ( shallowRef ( 'foo' ) ) )
173+
166174const refStatus = ref < Status > ( 'initial' )
167175if ( refStatus . value === 'initial' ) {
168176 expectType < Ref < Status > > ( shallowStatus )
@@ -386,7 +394,6 @@ describe('set/del', () => {
386394 del ( [ ] , 'fse' , 123 )
387395} )
388396
389-
390397{
391398 //#12978
392399 type Steps = { step : '1' } | { step : '2' }
@@ -395,4 +402,4 @@ describe('set/del', () => {
395402
396403 expectType < IsUnion < typeof shallowUnionGenParam > > ( false )
397404 expectType < IsUnion < typeof shallowUnionAsCast > > ( false )
398- }
405+ }
0 commit comments