Skip to content

Commit

Permalink
findBreakingChanges: Simplify type to string conversion (#1902)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed May 24, 2019
1 parent c906b7c commit bfc5bbb
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/utilities/findBreakingChanges.js
Expand Up @@ -227,7 +227,7 @@ function findArgChanges(
description:
`${oldType.name}.${fieldName} arg ` +
`${oldArgDef.name} has changed type from ` +
`${oldArgDef.type.toString()} to ${newArgDef.type.toString()}`,
`${String(oldArgDef.type)} to ${String(newArgDef.type)}`,
});
} else if (
oldArgDef.defaultValue !== undefined &&
Expand Down Expand Up @@ -335,17 +335,11 @@ function findFieldsThatChangedTypeOnObjectOrInterfaceTypes(
newFieldType,
);
if (!isSafe) {
const oldFieldTypeString = isNamedType(oldFieldType)
? oldFieldType.name
: oldFieldType.toString();
const newFieldTypeString = isNamedType(newFieldType)
? newFieldType.name
: newFieldType.toString();
breakingChanges.push({
type: BreakingChangeType.FIELD_CHANGED_KIND,
description:
`${typeName}.${fieldName} changed type from ` +
`${oldFieldTypeString} to ${newFieldTypeString}.`,
`${String(oldFieldType)} to ${String(newFieldType)}.`,
});
}
}
Expand Down Expand Up @@ -391,17 +385,11 @@ function findFieldsThatChangedTypeOnInputObjectTypes(
newFieldType,
);
if (!isSafe) {
const oldFieldTypeString = isNamedType(oldFieldType)
? oldFieldType.name
: oldFieldType.toString();
const newFieldTypeString = isNamedType(newFieldType)
? newFieldType.name
: newFieldType.toString();
breakingChanges.push({
type: BreakingChangeType.FIELD_CHANGED_KIND,
description:
`${typeName}.${fieldName} changed type from ` +
`${oldFieldTypeString} to ${newFieldTypeString}.`,
`${String(oldFieldType)} to ${String(newFieldType)}.`,
});
}
}
Expand Down

0 comments on commit bfc5bbb

Please sign in to comment.