@@ -28,7 +28,6 @@ import {
2828 isObjectType ,
2929} from '../../type/definition' ;
3030
31- import { applyRequiredStatus } from '../../utilities/applyRequiredStatus' ;
3231import { sortValueNode } from '../../utilities/sortValueNode' ;
3332import { typeFromAST } from '../../utilities/typeFromAST' ;
3433
@@ -607,16 +606,34 @@ function findConflict(
607606 const type2 = def2 ?. type ;
608607
609608 if ( type1 && type2 ) {
610- const modifiedType1 = applyRequiredStatus ( type1 , node1 . nullabilityAssertion ) ;
611- const modifiedType2 = applyRequiredStatus ( type2 , node2 . nullabilityAssertion ) ;
609+ // Two fields have different types
610+ if ( doTypesConflict ( type1 , type2 ) ) {
611+ return [
612+ [
613+ responseName ,
614+ `they return conflicting types "${ inspect ( type1 ) } " and "${ inspect (
615+ type2 ,
616+ ) } "`,
617+ ] ,
618+ [ node1 ] ,
619+ [ node2 ] ,
620+ ] ;
621+ }
612622
613- if ( doTypesConflict ( modifiedType1 , modifiedType2 ) ) {
623+ // Two fields have different required operators
624+ if ( node1 . nullabilityAssertion !== node2 . nullabilityAssertion ) {
614625 return [
615626 [
616627 responseName ,
617- `they return conflicting types "${ inspect (
618- modifiedType1 ,
619- ) } " and "${ inspect ( modifiedType2 ) } "`,
628+ `they have conflicting nullability designators "${
629+ node1 . nullabilityAssertion === undefined
630+ ? ''
631+ : print ( node1 . nullabilityAssertion )
632+ } " and "${
633+ node2 . nullabilityAssertion === undefined
634+ ? ''
635+ : print ( node2 . nullabilityAssertion )
636+ } "`,
620637 ] ,
621638 [ node1 ] ,
622639 [ node2 ] ,
0 commit comments