diff --git a/plugins/node/opentelemetry-instrumentation-graphql/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-graphql/src/instrumentation.ts index 52c7465a2f..efb54b6c87 100644 --- a/plugins/node/opentelemetry-instrumentation-graphql/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-graphql/src/instrumentation.ts @@ -307,8 +307,8 @@ export class GraphQLInstrumentation extends InstrumentationBase { schema: graphqlTypes.GraphQLSchema, documentAST: graphqlTypes.DocumentNode, rules?: ReadonlyArray, - typeInfo?: graphqlTypes.TypeInfo, - options?: { maxErrors?: number } + options?: { maxErrors?: number }, + typeInfo?: graphqlTypes.TypeInfo ): ReadonlyArray { return instrumentation._validate( this, @@ -373,8 +373,8 @@ export class GraphQLInstrumentation extends InstrumentationBase { schema, documentAST, rules, - typeInfo, - options + options, + typeInfo ); }, (err, errors) => { diff --git a/plugins/node/opentelemetry-instrumentation-graphql/src/types.ts b/plugins/node/opentelemetry-instrumentation-graphql/src/types.ts index 7f457dafcf..71aa242641 100644 --- a/plugins/node/opentelemetry-instrumentation-graphql/src/types.ts +++ b/plugins/node/opentelemetry-instrumentation-graphql/src/types.ts @@ -120,8 +120,8 @@ export type validateType = ( schema: graphqlTypes.GraphQLSchema, documentAST: graphqlTypes.DocumentNode, rules?: ReadonlyArray, + options?: { maxErrors?: number }, typeInfo?: graphqlTypes.TypeInfo, - options?: { maxErrors?: number } ) => ReadonlyArray; export interface GraphQLField { diff --git a/plugins/node/opentelemetry-instrumentation-graphql/src/utils.ts b/plugins/node/opentelemetry-instrumentation-graphql/src/utils.ts index 052953a5e5..cbf51f578d 100644 --- a/plugins/node/opentelemetry-instrumentation-graphql/src/utils.ts +++ b/plugins/node/opentelemetry-instrumentation-graphql/src/utils.ts @@ -387,7 +387,7 @@ export function wrapFieldResolver( > >( () => { - return fieldResolver.call(this, source, args, contextValue, info); + return fieldResolver.call(this, source, args, contextValue, info) as any; }, err => { if (shouldEndSpan) { @@ -421,7 +421,7 @@ async function safeExecuteInTheMiddleAsync( try { result = await execute(); } catch (e) { - error = e; + error = e as Error; } finally { onFinish(error, result); if (error && !preventThrowingError) { diff --git a/plugins/node/opentelemetry-instrumentation-graphql/test/graphql.test.ts b/plugins/node/opentelemetry-instrumentation-graphql/test/graphql.test.ts index 058e15d0c5..4e3195ae0c 100644 --- a/plugins/node/opentelemetry-instrumentation-graphql/test/graphql.test.ts +++ b/plugins/node/opentelemetry-instrumentation-graphql/test/graphql.test.ts @@ -1043,7 +1043,7 @@ describe('graphql', () => { describe('responseHook', () => { let spans: ReadableSpan[]; - let graphqlResult: graphqlTypes.ExecutionResult; + let graphqlResult: graphqlTypes.ExecutionResult<{books: unknown[]}>; const dataAttributeName = 'graphql_data'; afterEach(() => {