Skip to content

Commit 1575ae0

Browse files
elicwhitemeta-codesync[bot]
authored andcommitted
Rename TypeInformationComparisonError fields to match TypeAnnotationComparisonError (facebook#55302)
Summary: Pull Request resolved: facebook#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
1 parent 9553d7e commit 1575ae0

2 files changed

Lines changed: 7 additions & 18 deletions

File tree

packages/react-native-compatibility-check/src/ComparisonResult.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ type TypeAnnotationComparisonError = {
2424
type TypeInformationComparisonError = {
2525
type: 'TypeInformationComparisonError',
2626
message: string,
27-
newerType: CompleteTypeAnnotation,
28-
olderType: CompleteTypeAnnotation,
27+
newerAnnotation: CompleteTypeAnnotation,
28+
olderAnnotation: CompleteTypeAnnotation,
2929
previousError?: TypeComparisonError,
3030
};
3131
type PropertyComparisonError = {
@@ -179,15 +179,15 @@ export function makeError(error: TypeComparisonError): ComparisonResult {
179179

180180
export function typeInformationComparisonError(
181181
message: string,
182-
newerType: CompleteTypeAnnotation,
183-
olderType: CompleteTypeAnnotation,
182+
newerAnnotation: CompleteTypeAnnotation,
183+
olderAnnotation: CompleteTypeAnnotation,
184184
previousError?: TypeComparisonError,
185185
): TypeComparisonError {
186186
return {
187187
type: 'TypeInformationComparisonError',
188188
message,
189-
newerType,
190-
olderType,
189+
newerAnnotation,
190+
olderAnnotation,
191191
previousError,
192192
};
193193
}

packages/react-native-compatibility-check/src/ErrorFormatting.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export function formatErrorMessage(
5454
);
5555
return error.message + formattedPositionalChanges.join('');
5656
case 'TypeAnnotationComparisonError':
57+
case 'TypeInformationComparisonError':
5758
const previousError = error.previousError;
5859

5960
return (
@@ -70,18 +71,6 @@ export function formatErrorMessage(
7071
formatErrorMessage(previousError, indent + 2)
7172
: '')
7273
);
73-
case 'TypeInformationComparisonError':
74-
// I'm not sure that this error type is possible with the codegen
75-
76-
return (
77-
error.message +
78-
indentedLineStart(indent + 1) +
79-
'-- new: ' +
80-
formatTypeAnnotation(error.newerType) +
81-
indentedLineStart(indent + 1) +
82-
'-- old: ' +
83-
formatTypeAnnotation(error.olderType)
84-
);
8574
case 'MemberComparisonError':
8675
const formattedMembers = error.mismatchedMembers.map(
8776
individualMemberError =>

0 commit comments

Comments
 (0)