@@ -2,7 +2,8 @@ import type {
2
2
ApplyPath ,
3
3
MainWindow ,
4
4
PartytownForwardProperty ,
5
- PartytownForwardSettingsProperty ,
5
+ PartytownForwardPropertySettings ,
6
+ PartytownForwardPropertyWithSettings ,
6
7
RandomId ,
7
8
StringIndexable ,
8
9
} from './types' ;
@@ -145,16 +146,19 @@ export const isValidUrl = (url: any): boolean => {
145
146
}
146
147
} ;
147
148
149
+ const defaultPartytownForwardPropertySettings : Required < PartytownForwardPropertySettings > = {
150
+ preserveBehavior : false ,
151
+ } ;
152
+
148
153
export const resolvePartytownForwardProperty = (
149
- property : PartytownForwardProperty
150
- ) : PartytownForwardSettingsProperty => {
151
- if ( typeof property === 'string' ) {
152
- return {
153
- property,
154
- preserveBehavior : false ,
155
- } ;
154
+ propertyOrPropertyWithSettings : PartytownForwardProperty
155
+ ) : Required < PartytownForwardPropertyWithSettings > => {
156
+ if ( typeof propertyOrPropertyWithSettings === 'string' ) {
157
+ return [ propertyOrPropertyWithSettings , defaultPartytownForwardPropertySettings ] ;
156
158
}
157
- return property ;
159
+ const [ property , settings = defaultPartytownForwardPropertySettings ] =
160
+ propertyOrPropertyWithSettings ;
161
+ return [ property , { ...defaultPartytownForwardPropertySettings , ...settings } ] ;
158
162
} ;
159
163
160
164
type GetOriginalBehaviorReturn = {
0 commit comments