File tree Expand file tree Collapse file tree 1 file changed +15
-18
lines changed
packages/instrumentation-pg/src Expand file tree Collapse file tree 1 file changed +15
-18
lines changed Original file line number Diff line number Diff line change @@ -333,24 +333,21 @@ export class PgInstrumentation extends InstrumentationBase<PgInstrumentationConf
333333 // TODO: remove the `as ...` casts below when the TS version is upgraded.
334334 // Newer TS versions will use the result of firstArgIsQueryObjectWithText
335335 // to properly narrow arg0, but TS 4.3.5 does not.
336- let queryConfig : any ;
337-
338- if ( firstArgIsString ) {
339- queryConfig = {
340- text : arg0 as string ,
341- values : Array . isArray ( args [ 1 ] ) ? args [ 1 ] : undefined ,
342- } ;
343- } else if ( firstArgIsQueryObjectWithText ) {
344- const q = arg0 as any ;
345-
346- if ( q . values === undefined && Array . isArray ( args [ 1 ] ) ) {
347- q . values = args [ 1 ] ;
348- }
349-
350- queryConfig = q ;
351- } else {
352- queryConfig = undefined ;
353- }
336+ const queryConfig = firstArgIsString
337+ ? {
338+ text : arg0 as string ,
339+ values : Array . isArray ( args [ 1 ] ) ? args [ 1 ] : undefined ,
340+ }
341+ : firstArgIsQueryObjectWithText
342+ ? {
343+ ...( arg0 as any ) ,
344+ name : arg0 . name ,
345+ text : arg0 . text ,
346+ values :
347+ ( arg0 as any ) . values ??
348+ ( Array . isArray ( args [ 1 ] ) ? args [ 1 ] : undefined ) ,
349+ }
350+ : undefined ;
354351
355352 const attributes : Attributes = {
356353 [ ATTR_DB_SYSTEM ] : DB_SYSTEM_VALUE_POSTGRESQL ,
You can’t perform that action at this time.
0 commit comments