File tree 5 files changed +16
-14
lines changed
5 files changed +16
-14
lines changed Original file line number Diff line number Diff line change 30
30
- name : Run prettier
31
31
run : pnpm run format
32
32
33
- - uses : autofix-ci/action@bee19d72e71787c12ca0f29de72f2833e437e4c9
33
+ - uses : autofix-ci/action@ea32e3a12414e6d3183163c3424a7d7a8631ad84
Original file line number Diff line number Diff line change @@ -244,13 +244,19 @@ expectType<typeof r1>(p1)
244
244
// proxyRefs: `ShallowUnwrapRef`
245
245
const r2 = {
246
246
a : ref ( 1 ) ,
247
+ c : computed ( ( ) => 1 ) ,
248
+ u : undefined ,
247
249
obj : {
248
250
k : ref ( 'foo' )
249
- }
251
+ } ,
252
+ union : Math . random ( ) > 0 - 5 ? ref ( { name : 'yo' } ) : null
250
253
}
251
254
const p2 = proxyRefs ( r2 )
252
255
expectType < number > ( p2 . a )
256
+ expectType < number > ( p2 . c )
257
+ expectType < undefined > ( p2 . u )
253
258
expectType < Ref < string > > ( p2 . obj . k )
259
+ expectType < { name : string } | null > ( p2 . union )
254
260
255
261
// toRef and toRefs
256
262
{
Original file line number Diff line number Diff line change @@ -490,15 +490,11 @@ type BaseTypes = string | number | boolean
490
490
export interface RefUnwrapBailTypes { }
491
491
492
492
export type ShallowUnwrapRef < T > = {
493
- [ K in keyof T ] : T [ K ] extends Ref < infer V >
494
- ? V // if `V` is `unknown` that means it does not extend `Ref` and is undefined
495
- : T [ K ] extends Ref < infer V > | undefined
496
- ? unknown extends V
497
- ? undefined
498
- : V | undefined
499
- : T [ K ]
493
+ [ K in keyof T ] : DistrubuteRef < T [ K ] >
500
494
}
501
495
496
+ type DistrubuteRef < T > = T extends Ref < infer V > ? V : T
497
+
502
498
export type UnwrapRef < T > = T extends ShallowRef < infer V >
503
499
? V
504
500
: T extends Ref < infer V >
Original file line number Diff line number Diff line change 13
13
"vite" : " ^5.0.5"
14
14
},
15
15
"dependencies" : {
16
- "@vue/repl" : " ^3.0 .0" ,
16
+ "@vue/repl" : " ^3.1 .0" ,
17
17
"file-saver" : " ^2.0.5" ,
18
18
"jszip" : " ^3.10.1" ,
19
19
"vue" : " workspace:*"
You can’t perform that action at this time.
0 commit comments