@@ -85,14 +85,13 @@ export const defineContainer = <Props, VModelType = string | number | boolean>(
85
85
}
86
86
87
87
const emits : string [ ] = emitProps ;
88
- const props = componentProps . reduce (
88
+ const props = [ ROUTER_LINK_VALUE , ... componentProps ] . reduce (
89
89
( acc , prop ) => {
90
- acc [ prop ] = { type : null as unknown as PropType < any > , default : EMPTY_PROP } ;
90
+ acc [ prop ] = DEFAULT_EMPTY_PROP ;
91
91
return acc ;
92
92
} ,
93
93
{ } as Record < string , { type ?: PropType < any > ; default : Symbol } >
94
94
) as ComponentObjectPropsOptions < Props & InputProps < VModelType > > ;
95
- props [ ROUTER_LINK_VALUE ] = { type : null , default : DEFAULT_EMPTY_PROP } ;
96
95
if ( modelProp ) {
97
96
emits . push ( UPDATE_VALUE_EVENT ) ;
98
97
props [ MODEL_VALUE ] = DEFAULT_EMPTY_PROP as unknown as PropType < any > ;
@@ -109,8 +108,8 @@ export const defineContainer = <Props, VModelType = string | number | boolean>(
109
108
* we register the event emmiter for @Event definitions
110
109
* so we can use @event
111
110
*/
112
- emitProps . forEach ( ( eventName : string ) => {
113
- containerRef . value ! . addEventListener ( eventName , ( e : Event ) => {
111
+ emitProps . forEach ( ( eventName ) => {
112
+ containerRef . value ? .addEventListener ( eventName , ( e ) => {
114
113
emit ( eventName , e ) ;
115
114
} ) ;
116
115
} ) ;
@@ -199,7 +198,7 @@ export const defineContainer = <Props, VModelType = string | number | boolean>(
199
198
}
200
199
} ;
201
200
202
- let propsToAdd : any = {
201
+ const propsToAdd : Record < string , unknown > = {
203
202
ref : containerRef ,
204
203
class : getElementClasses ( containerRef , classes ) ,
205
204
onClick : handleClick ,
@@ -214,7 +213,7 @@ export const defineContainer = <Props, VModelType = string | number | boolean>(
214
213
for ( const key in props ) {
215
214
const value = props [ key as keyof InputProps < VModelType > ] ;
216
215
if ( ( props . hasOwnProperty ( key ) && value !== EMPTY_PROP ) || key . startsWith ( ARIA_PROP_PREFIX ) ) {
217
- propsToAdd [ key ] = value ;
216
+ propsToAdd [ key as 'ariaLabel' ] = value as string ;
218
217
}
219
218
220
219
/**
@@ -235,15 +234,9 @@ export const defineContainer = <Props, VModelType = string | number | boolean>(
235
234
* was set as a static value (i.e. no v-model).
236
235
*/
237
236
if ( props [ MODEL_VALUE ] !== EMPTY_PROP ) {
238
- propsToAdd = {
239
- ...propsToAdd ,
240
- [ modelProp ] : props [ MODEL_VALUE ] ,
241
- } ;
237
+ propsToAdd [ modelProp ] = props [ MODEL_VALUE ]
242
238
} else if ( modelPropValue !== EMPTY_PROP ) {
243
- propsToAdd = {
244
- ...propsToAdd ,
245
- [ modelProp ] : modelPropValue ,
246
- } ;
239
+ propsToAdd [ modelProp ] = modelPropValue
247
240
}
248
241
}
249
242
@@ -252,10 +245,7 @@ export const defineContainer = <Props, VModelType = string | number | boolean>(
252
245
// of components that should become activatable and
253
246
// focusable with router link.
254
247
if ( ROUTER_LINK_VALUE in props && props [ ROUTER_LINK_VALUE ] !== EMPTY_PROP ) {
255
- propsToAdd = {
256
- ...propsToAdd ,
257
- href : props [ ROUTER_LINK_VALUE ] ,
258
- } ;
248
+ propsToAdd . href = props [ ROUTER_LINK_VALUE ]
259
249
}
260
250
261
251
/**
0 commit comments