File tree 2 files changed +28
-4
lines changed
2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,18 @@ describe('should unwrap Map correctly', () => {
77
77
expectType < number > ( wm2 . get ( { } ) ! . wrap )
78
78
} )
79
79
80
+ describe ( 'should unwrap extended Map correctly' , ( ) => {
81
+ class ExtendendMap1 extends Map < string , { wrap : Ref < number > } > {
82
+ foo = ref ( 'foo' )
83
+ bar = 1
84
+ }
85
+
86
+ const emap1 = reactive ( new ExtendendMap1 ( ) )
87
+ expectType < string > ( emap1 . foo )
88
+ expectType < number > ( emap1 . bar )
89
+ expectType < number > ( emap1 . get ( 'a' ) ! . wrap )
90
+ } )
91
+
80
92
describe ( 'should unwrap Set correctly' , ( ) => {
81
93
const set = reactive ( new Set < Ref < number > > ( ) )
82
94
expectType < Set < Ref < number > > > ( set )
@@ -90,3 +102,14 @@ describe('should unwrap Set correctly', () => {
90
102
const ws2 = reactive ( new WeakSet < { wrap : Ref < number > } > ( ) )
91
103
expectType < WeakSet < { wrap : number } > > ( ws2 )
92
104
} )
105
+
106
+ describe ( 'should unwrap extended Set correctly' , ( ) => {
107
+ class ExtendendSet1 extends Set < { wrap : Ref < number > } > {
108
+ foo = ref ( 'foo' )
109
+ bar = 1
110
+ }
111
+
112
+ const eset1 = reactive ( new ExtendendSet1 ( ) )
113
+ expectType < string > ( eset1 . foo )
114
+ expectType < number > ( eset1 . bar )
115
+ } )
Original file line number Diff line number Diff line change @@ -500,13 +500,14 @@ export type UnwrapRefSimple<T> = T extends
500
500
| { [ RawSymbol ] ?: true }
501
501
? T
502
502
: T extends Map < infer K , infer V >
503
- ? Map < K , UnwrapRefSimple < V > >
503
+ ? Map < K , UnwrapRefSimple < V > > & UnwrapRef < Omit < T , keyof Map < any , any > > >
504
504
: T extends WeakMap < infer K , infer V >
505
- ? WeakMap < K , UnwrapRefSimple < V > >
505
+ ? WeakMap < K , UnwrapRefSimple < V > > &
506
+ UnwrapRef < Omit < T , keyof WeakMap < any , any > > >
506
507
: T extends Set < infer V >
507
- ? Set < UnwrapRefSimple < V > >
508
+ ? Set < UnwrapRefSimple < V > > & UnwrapRef < Omit < T , keyof Set < any > > >
508
509
: T extends WeakSet < infer V >
509
- ? WeakSet < UnwrapRefSimple < V > >
510
+ ? WeakSet < UnwrapRefSimple < V > > & UnwrapRef < Omit < T , keyof WeakSet < any > > >
510
511
: T extends ReadonlyArray < any >
511
512
? { [ K in keyof T ] : UnwrapRefSimple < T [ K ] > }
512
513
: T extends object & { [ ShallowReactiveMarker ] ?: never }
You can’t perform that action at this time.
0 commit comments