Rename TypeInformationComparisonError fields to match TypeAnnotationComparisonError (#55302)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55302

Rename newerType/olderType to newerAnnotation/olderAnnotation in TypeInformationComparisonError to be consistent with TypeAnnotationComparisonError. This allows code that handles both error types to access annotation fields uniformly without checking error type first.

Changelog: [Internal]

Reviewed By: makovkastar

Differential Revision: D91275947

fbshipit-source-id: 03a7a4aa521afea5bc8f21d6ab49309ad449b977
This commit is contained in:
Eli White
2026-01-26 14:04:07 -08:00
committed by meta-codesync[bot]
parent 9553d7eabe
commit 1575ae0e3f
2 changed files with 7 additions and 18 deletions
@@ -24,8 +24,8 @@ type TypeAnnotationComparisonError = {
type TypeInformationComparisonError = {
type: 'TypeInformationComparisonError',
message: string,
newerType: CompleteTypeAnnotation,
olderType: CompleteTypeAnnotation,
newerAnnotation: CompleteTypeAnnotation,
olderAnnotation: CompleteTypeAnnotation,
previousError?: TypeComparisonError,
};
type PropertyComparisonError = {
@@ -179,15 +179,15 @@ export function makeError(error: TypeComparisonError): ComparisonResult {
export function typeInformationComparisonError(
message: string,
newerType: CompleteTypeAnnotation,
olderType: CompleteTypeAnnotation,
newerAnnotation: CompleteTypeAnnotation,
olderAnnotation: CompleteTypeAnnotation,
previousError?: TypeComparisonError,
): TypeComparisonError {
return {
type: 'TypeInformationComparisonError',
message,
newerType,
olderType,
newerAnnotation,
olderAnnotation,
previousError,
};
}
@@ -54,6 +54,7 @@ export function formatErrorMessage(
);
return error.message + formattedPositionalChanges.join('');
case 'TypeAnnotationComparisonError':
case 'TypeInformationComparisonError':
const previousError = error.previousError;
return (
@@ -70,18 +71,6 @@ export function formatErrorMessage(
formatErrorMessage(previousError, indent + 2)
: '')
);
case 'TypeInformationComparisonError':
// I'm not sure that this error type is possible with the codegen
return (
error.message +
indentedLineStart(indent + 1) +
'-- new: ' +
formatTypeAnnotation(error.newerType) +
indentedLineStart(indent + 1) +
'-- old: ' +
formatTypeAnnotation(error.olderType)
);
case 'MemberComparisonError':
const formattedMembers = error.mismatchedMembers.map(
individualMemberError =>