mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Array's with unparsable element type's are explicitly Any vs missing (#46221)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46221 Previously the schema special cased unparseable elementType with elementType just being undefined. This causes issues for logic that requires recursively matching types. Instead of being implicit, this makes them explicitly an AnyTypeAnnotation Changelog: [Internal] Reviewed By: makovkastar Differential Revision: D61825742 fbshipit-source-id: 47bf70d32d21647896d8f5319087378cc8ac8d4f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0f66a696b4
commit
0b56ccab2a
Vendored
+4
-1
@@ -93,9 +93,12 @@ class StructCollector {
|
||||
});
|
||||
}
|
||||
case 'ArrayTypeAnnotation': {
|
||||
if (typeAnnotation.elementType == null) {
|
||||
if (typeAnnotation.elementType.type === 'AnyTypeAnnotation') {
|
||||
return wrapNullable(nullable, {
|
||||
type: 'ArrayTypeAnnotation',
|
||||
elementType: {
|
||||
type: 'AnyTypeAnnotation',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -118,7 +118,7 @@ function toObjCType(
|
||||
case 'GenericObjectTypeAnnotation':
|
||||
return wrapObjCOptional('id<NSObject>', isRequired);
|
||||
case 'ArrayTypeAnnotation':
|
||||
if (typeAnnotation.elementType == null) {
|
||||
if (typeAnnotation.elementType.type === 'AnyTypeAnnotation') {
|
||||
return wrapObjCOptional('id<NSObject>', isRequired);
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ function toObjCValue(
|
||||
return value;
|
||||
case 'ArrayTypeAnnotation':
|
||||
const {elementType} = typeAnnotation;
|
||||
if (elementType == null) {
|
||||
if (elementType.type === 'AnyTypeAnnotation') {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -109,7 +109,7 @@ function toObjCType(
|
||||
case 'GenericObjectTypeAnnotation':
|
||||
return wrapObjCOptional('id<NSObject>', isRequired);
|
||||
case 'ArrayTypeAnnotation':
|
||||
if (typeAnnotation.elementType == null) {
|
||||
if (typeAnnotation.elementType.type === 'AnyTypeAnnotation') {
|
||||
return wrapObjCOptional('id<NSObject>', isRequired);
|
||||
}
|
||||
return wrapCxxOptional(
|
||||
@@ -188,7 +188,7 @@ function toObjCValue(
|
||||
return value;
|
||||
case 'ArrayTypeAnnotation':
|
||||
const {elementType} = typeAnnotation;
|
||||
if (elementType == null) {
|
||||
if (elementType.type === 'AnyTypeAnnotation') {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -305,7 +305,7 @@ function getReturnObjCType(
|
||||
case 'TypeAliasTypeAnnotation':
|
||||
return wrapOptional('NSDictionary *', isRequired);
|
||||
case 'ArrayTypeAnnotation':
|
||||
if (typeAnnotation.elementType == null) {
|
||||
if (typeAnnotation.elementType.type === 'AnyTypeAnnotation') {
|
||||
return wrapOptional('NSArray<id<NSObject>> *', isRequired);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user