@react-native/codegen 0.88.0-nightly-20260713-b31ba29d2 → 0.88.0-nightly-20260715-ef54f74de
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/CodegenSchema.js.flow +5 -10
- package/lib/parsers/flow/components/commands.js.flow +6 -8
- package/lib/parsers/typescript/components/commands.js.flow +7 -9
- package/lib/parsers/typescript/components/componentsUtils.js.flow +2 -4
- package/lib/parsers/utils.js.flow +9 -13
- package/package.json +1 -1
|
@@ -270,8 +270,7 @@ export type ReservedTypeAnnotation = Readonly<{
|
|
|
270
270
|
* NativeModule Types
|
|
271
271
|
*/
|
|
272
272
|
export type Nullable<out T extends NativeModuleTypeAnnotation> =
|
|
273
|
-
|
|
274
|
-
| T;
|
|
273
|
+
NullableTypeAnnotation<T> | T;
|
|
275
274
|
|
|
276
275
|
export type NullableTypeAnnotation<out T extends NativeModuleTypeAnnotation> =
|
|
277
276
|
Readonly<{
|
|
@@ -345,8 +344,7 @@ export type NativeModuleEnumMember = {
|
|
|
345
344
|
};
|
|
346
345
|
|
|
347
346
|
export type NativeModuleEnumMemberType =
|
|
348
|
-
| '
|
|
349
|
-
| 'StringTypeAnnotation';
|
|
347
|
+
'NumberTypeAnnotation' | 'StringTypeAnnotation';
|
|
350
348
|
|
|
351
349
|
export type NativeModuleEnumDeclaration = Readonly<{
|
|
352
350
|
name: string,
|
|
@@ -436,12 +434,10 @@ export type NativeModuleBaseTypeAnnotation =
|
|
|
436
434
|
| NativeModuleMixedTypeAnnotation;
|
|
437
435
|
|
|
438
436
|
export type NativeModuleParamTypeAnnotation =
|
|
439
|
-
|
|
|
440
|
-
| NativeModuleParamOnlyTypeAnnotation;
|
|
437
|
+
NativeModuleBaseTypeAnnotation | NativeModuleParamOnlyTypeAnnotation;
|
|
441
438
|
|
|
442
439
|
export type NativeModuleReturnTypeAnnotation =
|
|
443
|
-
|
|
|
444
|
-
| NativeModuleReturnOnlyTypeAnnotation;
|
|
440
|
+
NativeModuleBaseTypeAnnotation | NativeModuleReturnOnlyTypeAnnotation;
|
|
445
441
|
|
|
446
442
|
export type NativeModuleTypeAnnotation =
|
|
447
443
|
| NativeModuleBaseTypeAnnotation
|
|
@@ -452,8 +448,7 @@ export type NativeModuleTypeAnnotation =
|
|
|
452
448
|
type NativeModuleParamOnlyTypeAnnotation = NativeModuleFunctionTypeAnnotation;
|
|
453
449
|
|
|
454
450
|
type NativeModuleReturnOnlyTypeAnnotation =
|
|
455
|
-
|
|
|
456
|
-
| VoidTypeAnnotation;
|
|
451
|
+
NativeModulePromiseTypeAnnotation | VoidTypeAnnotation;
|
|
457
452
|
|
|
458
453
|
// Add the allowed component reserved types to the native module union
|
|
459
454
|
export type CompleteReservedTypeAnnotation =
|
|
@@ -49,14 +49,12 @@ function buildCommandSchema(
|
|
|
49
49
|
|
|
50
50
|
const firstParam = value.params[0].typeAnnotation;
|
|
51
51
|
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
)
|
|
59
|
-
) {
|
|
52
|
+
if (!(
|
|
53
|
+
firstParam.id != null &&
|
|
54
|
+
firstParam.id.type === 'QualifiedTypeIdentifier' &&
|
|
55
|
+
firstParam.id.qualification.name === 'React' &&
|
|
56
|
+
firstParam.id.id.name === 'ElementRef'
|
|
57
|
+
)) {
|
|
60
58
|
throw new Error(
|
|
61
59
|
`The first argument of method ${name} must be of type React.ElementRef<>`,
|
|
62
60
|
);
|
|
@@ -33,15 +33,13 @@ function buildCommandSchemaInternal(
|
|
|
33
33
|
parser: Parser,
|
|
34
34
|
): NamedShape<CommandTypeAnnotation> {
|
|
35
35
|
const firstParam = parameters[0].typeAnnotation;
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
)
|
|
44
|
-
) {
|
|
36
|
+
if (!(
|
|
37
|
+
firstParam.typeAnnotation != null &&
|
|
38
|
+
firstParam.typeAnnotation.type === 'TSTypeReference' &&
|
|
39
|
+
firstParam.typeAnnotation.typeName.left?.name === 'React' &&
|
|
40
|
+
(firstParam.typeAnnotation.typeName.right?.name === 'ElementRef' ||
|
|
41
|
+
firstParam.typeAnnotation.typeName.right?.name === 'ComponentRef')
|
|
42
|
+
)) {
|
|
45
43
|
throw new Error(
|
|
46
44
|
`The first argument of method ${name} must be of type React.ElementRef<> or React.ComponentRef<>`,
|
|
47
45
|
);
|
|
@@ -354,8 +354,7 @@ function setDefaultValue(
|
|
|
354
354
|
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
|
|
355
355
|
* roll out. See https://fburl.com/workplace/5whu3i34. */
|
|
356
356
|
(defaultValue === null ? null : defaultValue ? defaultValue : 0) as
|
|
357
|
-
|
|
|
358
|
-
| null;
|
|
357
|
+
number | null;
|
|
359
358
|
break;
|
|
360
359
|
case 'BooleanTypeAnnotation':
|
|
361
360
|
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
|
|
@@ -364,8 +363,7 @@ function setDefaultValue(
|
|
|
364
363
|
break;
|
|
365
364
|
case 'StringTypeAnnotation':
|
|
366
365
|
common.default = (defaultValue === undefined ? null : defaultValue) as
|
|
367
|
-
|
|
|
368
|
-
| null;
|
|
366
|
+
string | null;
|
|
369
367
|
break;
|
|
370
368
|
}
|
|
371
369
|
}
|
|
@@ -177,22 +177,18 @@ function isModuleRegistryCall(node: $FlowFixMe): boolean {
|
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
const memberExpression = callExpression.callee;
|
|
180
|
-
if (
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
)
|
|
185
|
-
) {
|
|
180
|
+
if (!(
|
|
181
|
+
memberExpression.object.type === 'Identifier' &&
|
|
182
|
+
memberExpression.object.name === 'TurboModuleRegistry'
|
|
183
|
+
)) {
|
|
186
184
|
return false;
|
|
187
185
|
}
|
|
188
186
|
|
|
189
|
-
if (
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
)
|
|
195
|
-
) {
|
|
187
|
+
if (!(
|
|
188
|
+
memberExpression.property.type === 'Identifier' &&
|
|
189
|
+
(memberExpression.property.name === 'get' ||
|
|
190
|
+
memberExpression.property.name === 'getEnforcing')
|
|
191
|
+
)) {
|
|
196
192
|
return false;
|
|
197
193
|
}
|
|
198
194
|
|