diff --git a/src/execution/__tests__/abstract-test.ts b/src/execution/__tests__/abstract-test.ts index fde551b88d..422f99c0c2 100644 --- a/src/execution/__tests__/abstract-test.ts +++ b/src/execution/__tests__/abstract-test.ts @@ -633,15 +633,7 @@ describe('Execute: Handles execution of abstract types', () => { // @ts-expect-error assertInterfaceType(schema.getType('Pet')).resolveType = () => []; expectError({ forTypeName: undefined }).toEqual( - 'Abstract type "Pet" must resolve to an Object type at runtime for field "Query.pet" with value { __typename: undefined }, received "[]".', - ); - - // FIXME: workaround since we can't inject resolveType into SDL - // @ts-expect-error - assertInterfaceType(schema.getType('Pet')).resolveType = () => - schema.getType('Cat'); - expectError({ forTypeName: undefined }).toEqual( - 'Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.', + 'Abstract type "Pet" must resolve to an Object type at runtime for field "Query.pet" with value { __typename: undefined }, received "[]", which is not a valid Object type name.', ); }); }); diff --git a/src/execution/execute.ts b/src/execution/execute.ts index 97e88f07ad..2a766a6894 100644 --- a/src/execution/execute.ts +++ b/src/execution/execute.ts @@ -1588,18 +1588,12 @@ function ensureValidRuntimeType( ); } - // releases before 16.0.0 supported returning `GraphQLObjectType` from `resolveType` - // TODO: remove in 17.0.0 release - if (isObjectType(runtimeTypeName)) { - throw new GraphQLError( - 'Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.', - ); - } - if (typeof runtimeTypeName !== 'string') { throw new GraphQLError( `Abstract type "${returnType}" must resolve to an Object type at runtime for field "${info.parentType}.${info.fieldName}" with ` + - `value ${inspect(result)}, received "${inspect(runtimeTypeName)}".`, + `value ${inspect(result)}, received "${inspect( + runtimeTypeName, + )}", which is not a valid Object type name.`, ); }