@@ -174,9 +174,12 @@ export function makeIntegrationFn<
174
174
// eslint-disable-next-line @typescript-eslint/no-explicit-any
175
175
Fn extends ( ...rest : any [ ] ) => Partial < IntegrationFnResult > ,
176
176
> ( name : string , fn : Fn ) : ( ( ...rest : Parameters < Fn > ) => ReturnType < Fn > & { name : string } ) & { id : string } {
177
- const patchedFn = addNameToIntegrationFnResult ( name , fn ) ;
177
+ const patchedFn = addNameToIntegrationFnResult ( name , fn ) as ( (
178
+ ...rest : Parameters < Fn >
179
+ ) => ReturnType < Fn > & { name : string } ) & { id : string } ;
178
180
179
- return Object . assign ( patchedFn , { id : name } ) ;
181
+ patchedFn . id = name ;
182
+ return patchedFn ;
180
183
}
181
184
182
185
/**
@@ -192,14 +195,12 @@ export function convertIntegrationFnToClass<
192
195
return Object . assign (
193
196
// eslint-disable-next-line @typescript-eslint/no-explicit-any
194
197
function ConvertedIntegration ( ...rest : any [ ] ) {
195
- const res = {
198
+ return {
196
199
// eslint-disable-next-line @typescript-eslint/no-empty-function
197
200
setupOnce : ( ) => { } ,
198
201
...fn ( ...rest ) ,
199
202
name : fn . id ,
200
203
} ;
201
-
202
- return res ;
203
204
} ,
204
205
{ id : fn . id } ,
205
206
) as unknown as IntegrationClass < Integration > ;
@@ -210,7 +211,9 @@ function addNameToIntegrationFnResult<
210
211
Fn extends ( ...rest : any [ ] ) => Partial < IntegrationFnResult > ,
211
212
> ( name : string , fn : Fn ) : ( ...rest : Parameters < Fn > ) => ReturnType < Fn > & { name : string } {
212
213
const patchedFn = ( ...rest : Parameters < Fn > ) : ReturnType < Fn > & { name : string } => {
213
- return { ...fn ( ...rest ) , name } as ReturnType < Fn > & { name : string } ;
214
+ const result = fn ( ...rest ) ;
215
+ result . name = name ;
216
+ return result as ReturnType < Fn > & { name : string } ;
214
217
} ;
215
218
216
219
return patchedFn ;
0 commit comments