@@ -42,15 +42,19 @@ export function FieldsOnCorrectTypeRule(
4242 const schema = context . getSchema ( ) ;
4343 const fieldName = node . name . value ;
4444
45- // First determine if there are any suggested types to condition on.
46- let suggestion = didYouMean (
47- 'to use an inline fragment on' ,
48- getSuggestedTypeNames ( schema , type , fieldName ) ,
49- ) ;
50-
51- // If there are no suggested types, then perhaps this was a typo?
52- if ( suggestion === '' ) {
53- suggestion = didYouMean ( getSuggestedFieldNames ( type , fieldName ) ) ;
45+ let suggestion = '' ;
46+
47+ if ( context . didYouMean ) {
48+ // First determine if there are any suggested types to condition on.
49+ suggestion = didYouMean (
50+ 'to use an inline fragment on' ,
51+ getSuggestedTypeNames ( schema , type , fieldName ) ,
52+ ) ;
53+
54+ // If there are no suggested types, then perhaps this was a typo?
55+ if ( suggestion === '' ) {
56+ suggestion = didYouMean ( getSuggestedFieldNames ( type , fieldName ) ) ;
57+ }
5458 }
5559
5660 // Report an error, including helpful suggestions.
0 commit comments