@@ -29,7 +29,6 @@ import {
2929 isObjectType ,
3030} from '../../type/definition.js' ;
3131
32- import { applyRequiredStatus } from '../../utilities/applyRequiredStatus' ;
3332import { sortValueNode } from '../../utilities/sortValueNode' ;
3433import { typeFromAST } from '../../utilities/typeFromAST' ;
3534
@@ -619,16 +618,34 @@ function findConflict(
619618 const type2 = def2 ?. type ;
620619
621620 if ( type1 && type2 ) {
622- const modifiedType1 = applyRequiredStatus ( type1 , node1 . nullabilityAssertion ) ;
623- const modifiedType2 = applyRequiredStatus ( type2 , node2 . nullabilityAssertion ) ;
621+ // Two fields have different types
622+ if ( doTypesConflict ( type1 , type2 ) ) {
623+ return [
624+ [
625+ responseName ,
626+ `they return conflicting types "${ inspect ( type1 ) } " and "${ inspect (
627+ type2 ,
628+ ) } "`,
629+ ] ,
630+ [ node1 ] ,
631+ [ node2 ] ,
632+ ] ;
633+ }
624634
625- if ( doTypesConflict ( modifiedType1 , modifiedType2 ) ) {
635+ // Two fields have different required operators
636+ if ( node1 . nullabilityAssertion !== node2 . nullabilityAssertion ) {
626637 return [
627638 [
628639 responseName ,
629- `they return conflicting types "${ inspect (
630- modifiedType1 ,
631- ) } " and "${ inspect ( modifiedType2 ) } "`,
640+ `they have conflicting nullability designators "${
641+ node1 . nullabilityAssertion === undefined
642+ ? ''
643+ : print ( node1 . nullabilityAssertion )
644+ } " and "${
645+ node2 . nullabilityAssertion === undefined
646+ ? ''
647+ : print ( node2 . nullabilityAssertion )
648+ } "`,
632649 ] ,
633650 [ node1 ] ,
634651 [ node2 ] ,
0 commit comments