diff --git a/src/execution/__tests__/executor-test.ts b/src/execution/__tests__/executor-test.ts index b886270978..5283aa4de5 100644 --- a/src/execution/__tests__/executor-test.ts +++ b/src/execution/__tests__/executor-test.ts @@ -94,7 +94,7 @@ describe('Execute: Handles basic execution tasks', () => { return Promise.resolve(data); } - const DataType = new GraphQLObjectType({ + const DataType: GraphQLObjectType = new GraphQLObjectType({ name: 'DataType', fields: () => ({ a: { type: GraphQLString }, @@ -185,7 +185,7 @@ describe('Execute: Handles basic execution tasks', () => { }); it('merges parallel fragments', () => { - const Type = new GraphQLObjectType({ + const Type: GraphQLObjectType = new GraphQLObjectType({ name: 'Type', fields: () => ({ a: { type: GraphQLString, resolve: () => 'Apple' }, @@ -624,7 +624,7 @@ describe('Execute: Handles basic execution tasks', () => { }); it('Full response path is included for non-nullable fields', () => { - const A = new GraphQLObjectType({ + const A: GraphQLObjectType = new GraphQLObjectType({ name: 'A', fields: () => ({ nullableA: { diff --git a/src/execution/__tests__/schema-test.ts b/src/execution/__tests__/schema-test.ts index 7da7849c5a..b954fd98db 100644 --- a/src/execution/__tests__/schema-test.ts +++ b/src/execution/__tests__/schema-test.ts @@ -29,7 +29,7 @@ describe('Execute: Handles execution with a complex schema', () => { }, }); - const BlogAuthor = new GraphQLObjectType({ + const BlogAuthor: GraphQLObjectType = new GraphQLObjectType({ name: 'Author', fields: () => ({ id: { type: GraphQLString }, diff --git a/src/execution/__tests__/union-interface-test.ts b/src/execution/__tests__/union-interface-test.ts index d65ada60c5..7ff9bd72bb 100644 --- a/src/execution/__tests__/union-interface-test.ts +++ b/src/execution/__tests__/union-interface-test.ts @@ -65,14 +65,14 @@ const NamedType = new GraphQLInterfaceType({ }, }); -const LifeType = new GraphQLInterfaceType({ +const LifeType: GraphQLInterfaceType = new GraphQLInterfaceType({ name: 'Life', fields: () => ({ progeny: { type: new GraphQLList(LifeType) }, }), }); -const MammalType = new GraphQLInterfaceType({ +const MammalType: GraphQLInterfaceType = new GraphQLInterfaceType({ name: 'Mammal', interfaces: [LifeType], fields: () => ({ @@ -82,7 +82,7 @@ const MammalType = new GraphQLInterfaceType({ }), }); -const DogType = new GraphQLObjectType({ +const DogType: GraphQLObjectType = new GraphQLObjectType({ name: 'Dog', interfaces: [MammalType, LifeType, NamedType], fields: () => ({ @@ -95,7 +95,7 @@ const DogType = new GraphQLObjectType({ isTypeOf: (value) => value instanceof Dog, }); -const CatType = new GraphQLObjectType({ +const CatType: GraphQLObjectType = new GraphQLObjectType({ name: 'Cat', interfaces: [MammalType, LifeType, NamedType], fields: () => ({ @@ -125,7 +125,7 @@ const PetType = new GraphQLUnionType({ }, }); -const PersonType = new GraphQLObjectType({ +const PersonType: GraphQLObjectType = new GraphQLObjectType({ name: 'Person', interfaces: [NamedType, MammalType, LifeType], fields: () => ({ @@ -503,7 +503,7 @@ describe('Execute: Union and intersection types', () => { let encounteredSchema; let encounteredRootValue; - const NamedType2 = new GraphQLInterfaceType({ + const NamedType2: GraphQLInterfaceType = new GraphQLInterfaceType({ name: 'Named', fields: { name: { type: GraphQLString }, @@ -516,7 +516,7 @@ describe('Execute: Union and intersection types', () => { }, }); - const PersonType2 = new GraphQLObjectType({ + const PersonType2: GraphQLObjectType = new GraphQLObjectType({ name: 'Person', interfaces: [NamedType2], fields: { diff --git a/src/execution/__tests__/variables-test.ts b/src/execution/__tests__/variables-test.ts index ad71465568..ebf7d0b169 100644 --- a/src/execution/__tests__/variables-test.ts +++ b/src/execution/__tests__/variables-test.ts @@ -7,7 +7,10 @@ import { invariant } from '../../jsutils/invariant'; import { Kind } from '../../language/kinds'; import { parse } from '../../language/parser'; -import type { GraphQLArgumentConfig } from '../../type/definition'; +import type { + GraphQLFieldConfig, + GraphQLArgumentConfig, +} from '../../type/definition'; import { GraphQLSchema } from '../../type/schema'; import { GraphQLString } from '../../type/scalars'; import { @@ -64,7 +67,9 @@ const TestEnum = new GraphQLEnumType({ }, }); -function fieldWithInputArg(inputArg: GraphQLArgumentConfig) { +function fieldWithInputArg( + inputArg: GraphQLArgumentConfig, +): GraphQLFieldConfig { return { type: GraphQLString, args: { input: inputArg }, diff --git a/src/execution/execute.ts b/src/execution/execute.ts index 923d018d1a..5d7f25e722 100644 --- a/src/execution/execute.ts +++ b/src/execution/execute.ts @@ -180,7 +180,7 @@ export function execute(args: ExecutionArgs): PromiseOrValue { ); // Return early errors if execution context failed. - if (Array.isArray(exeContext)) { + if (!('schema' in exeContext)) { return { errors: exeContext }; } @@ -191,9 +191,7 @@ export function execute(args: ExecutionArgs): PromiseOrValue { // field and its descendants will be omitted, and sibling fields will still // be executed. An execution which encounters errors will still result in a // resolved Promise. - // @ts-expect-error FIXME: TS Conversion const data = executeOperation(exeContext, exeContext.operation, rootValue); - // @ts-expect-error FIXME: TS Conversion return buildResponse(exeContext, data); } diff --git a/src/execution/values.ts b/src/execution/values.ts index 05277f3827..6d4c95b85a 100644 --- a/src/execution/values.ts +++ b/src/execution/values.ts @@ -77,7 +77,7 @@ function coerceVariableValues( inputs: { readonly [variable: string]: unknown }, onError: (error: GraphQLError) => void, ): { [variable: string]: unknown } { - const coercedValues = {}; + const coercedValues: { [variable: string]: unknown } = {}; for (const varDefNode of varDefNodes) { const varName = varDefNode.variable.name.value; const varType = typeFromAST(schema, varDefNode.type); @@ -162,7 +162,7 @@ export function getArgumentValues( node: FieldNode | DirectiveNode, variableValues?: Maybe>, ): { [argument: string]: unknown } { - const coercedValues = {}; + const coercedValues: { [argument: string]: unknown } = {}; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') const argumentNodes = node.arguments ?? [];