@@ -29,7 +29,6 @@ import {
29
29
isObjectType ,
30
30
} from '../../type/definition.js' ;
31
31
32
- import { applyRequiredStatus } from '../../utilities/applyRequiredStatus' ;
33
32
import { sortValueNode } from '../../utilities/sortValueNode' ;
34
33
import { typeFromAST } from '../../utilities/typeFromAST' ;
35
34
@@ -619,16 +618,34 @@ function findConflict(
619
618
const type2 = def2 ?. type ;
620
619
621
620
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
+ }
624
634
625
- if ( doTypesConflict ( modifiedType1 , modifiedType2 ) ) {
635
+ // Two fields have different required operators
636
+ if ( node1 . nullabilityAssertion !== node2 . nullabilityAssertion ) {
626
637
return [
627
638
[
628
639
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
+ } "`,
632
649
] ,
633
650
[ node1 ] ,
634
651
[ node2 ] ,
0 commit comments