@react-native/codegen 0.84.0-nightly-20251109-b7012ba92 → 0.84.0-nightly-20251111-4f490818a
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.
|
@@ -16,7 +16,7 @@ const {getPrimitiveTypeAnnotation} = require('./componentsUtils');
|
|
|
16
16
|
// $FlowFixMe[unclear-type] there's no flowtype for ASTs
|
|
17
17
|
|
|
18
18
|
function buildCommandSchemaInternal(name, optional, parameters, types, parser) {
|
|
19
|
-
var _firstParam$typeAnnot, _firstParam$typeAnnot2;
|
|
19
|
+
var _firstParam$typeAnnot, _firstParam$typeAnnot2, _firstParam$typeAnnot3;
|
|
20
20
|
const firstParam = parameters[0].typeAnnotation;
|
|
21
21
|
if (
|
|
22
22
|
!(
|
|
@@ -26,14 +26,18 @@ function buildCommandSchemaInternal(name, optional, parameters, types, parser) {
|
|
|
26
26
|
null || _firstParam$typeAnnot === void 0
|
|
27
27
|
? void 0
|
|
28
28
|
: _firstParam$typeAnnot.name) === 'React' &&
|
|
29
|
-
((_firstParam$typeAnnot2 = firstParam.typeAnnotation.typeName.right) ===
|
|
29
|
+
(((_firstParam$typeAnnot2 = firstParam.typeAnnotation.typeName.right) ===
|
|
30
30
|
null || _firstParam$typeAnnot2 === void 0
|
|
31
31
|
? void 0
|
|
32
|
-
: _firstParam$typeAnnot2.name) === 'ElementRef'
|
|
32
|
+
: _firstParam$typeAnnot2.name) === 'ElementRef' ||
|
|
33
|
+
((_firstParam$typeAnnot3 = firstParam.typeAnnotation.typeName.right) ===
|
|
34
|
+
null || _firstParam$typeAnnot3 === void 0
|
|
35
|
+
? void 0
|
|
36
|
+
: _firstParam$typeAnnot3.name) === 'ComponentRef')
|
|
33
37
|
)
|
|
34
38
|
) {
|
|
35
39
|
throw new Error(
|
|
36
|
-
`The first argument of method ${name} must be of type React.ElementRef<>`,
|
|
40
|
+
`The first argument of method ${name} must be of type React.ElementRef<> or React.ComponentRef<>`,
|
|
37
41
|
);
|
|
38
42
|
}
|
|
39
43
|
const params = parameters.slice(1).map(param => {
|
|
@@ -38,11 +38,12 @@ function buildCommandSchemaInternal(
|
|
|
38
38
|
firstParam.typeAnnotation != null &&
|
|
39
39
|
firstParam.typeAnnotation.type === 'TSTypeReference' &&
|
|
40
40
|
firstParam.typeAnnotation.typeName.left?.name === 'React' &&
|
|
41
|
-
firstParam.typeAnnotation.typeName.right?.name === 'ElementRef'
|
|
41
|
+
(firstParam.typeAnnotation.typeName.right?.name === 'ElementRef' ||
|
|
42
|
+
firstParam.typeAnnotation.typeName.right?.name === 'ComponentRef')
|
|
42
43
|
)
|
|
43
44
|
) {
|
|
44
45
|
throw new Error(
|
|
45
|
-
`The first argument of method ${name} must be of type React.ElementRef<>`,
|
|
46
|
+
`The first argument of method ${name} must be of type React.ElementRef<> or React.ComponentRef<>`,
|
|
46
47
|
);
|
|
47
48
|
}
|
|
48
49
|
|