mirror of
https://github.com/react/react-native.git
synced 2026-09-28 05:13:06 +08:00
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:
committed by
meta-codesync[bot]
parent
9553d7eabe
commit
1575ae0e3f
@@ -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 =>
|
||||
|
||||
Reference in New Issue
Block a user