@react-native/codegen 0.75.0-rc.1 → 0.76.0-nightly-20240627-TEMP

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.
@@ -60,7 +60,7 @@ export interface MixedTypeAnnotation {
60
60
 
61
61
  export interface EventEmitterTypeAnnotation {
62
62
  readonly type: 'EventEmitterTypeAnnotation';
63
- readonly typeAnnotation: NativeModuleBaseTypeAnnotation;
63
+ readonly typeAnnotation: NativeModuleEventEmitterTypeAnnotation;
64
64
  }
65
65
 
66
66
  export interface FunctionTypeAnnotation<P, R> {
@@ -360,6 +360,23 @@ export interface NativeModuleMixedTypeAnnotation {
360
360
  readonly type: 'MixedTypeAnnotation';
361
361
  }
362
362
 
363
+ export type NativeModuleEventEmitterBaseTypeAnnotation =
364
+ | NativeModuleBooleanTypeAnnotation
365
+ | NativeModuleDoubleTypeAnnotation
366
+ | NativeModuleFloatTypeAnnotation
367
+ | NativeModuleInt32TypeAnnotation
368
+ | NativeModuleNumberTypeAnnotation
369
+ | NativeModuleStringTypeAnnotation
370
+ | NativeModuleTypeAliasTypeAnnotation
371
+ | VoidTypeAnnotation;
372
+
373
+ export type NativeModuleEventEmitterTypeAnnotation =
374
+ | NativeModuleEventEmitterBaseTypeAnnotation
375
+ | {
376
+ readonly type: 'ArrayTypeAnnotation';
377
+ readonly elementType: NativeModuleEventEmitterBaseTypeAnnotation | {type: string};
378
+ };
379
+
363
380
  export type NativeModuleBaseTypeAnnotation =
364
381
  | NativeModuleStringTypeAnnotation
365
382
  | NativeModuleNumberTypeAnnotation
@@ -387,7 +404,8 @@ export type NativeModuleReturnTypeAnnotation =
387
404
  export type NativeModuleTypeAnnotation =
388
405
  | NativeModuleBaseTypeAnnotation
389
406
  | NativeModuleParamOnlyTypeAnnotation
390
- | NativeModuleReturnOnlyTypeAnnotation;
407
+ | NativeModuleReturnOnlyTypeAnnotation
408
+ | NativeModuleEventEmitterTypeAnnotation;
391
409
 
392
410
  type NativeModuleParamOnlyTypeAnnotation = NativeModuleFunctionTypeAnnotation;
393
411
 
@@ -63,7 +63,7 @@ export type MixedTypeAnnotation = $ReadOnly<{
63
63
 
64
64
  type EventEmitterTypeAnnotation = $ReadOnly<{
65
65
  type: 'EventEmitterTypeAnnotation',
66
- typeAnnotation: NativeModuleBaseTypeAnnotation,
66
+ typeAnnotation: NativeModuleEventEmitterTypeAnnotation | $FlowFixMe,
67
67
  }>;
68
68
 
69
69
  type FunctionTypeAnnotation<+P, +R> = $ReadOnly<{
@@ -366,6 +366,23 @@ export type NativeModuleMixedTypeAnnotation = $ReadOnly<{
366
366
  type: 'MixedTypeAnnotation',
367
367
  }>;
368
368
 
369
+ type NativeModuleEventEmitterBaseTypeAnnotation =
370
+ | NativeModuleBooleanTypeAnnotation
371
+ | NativeModuleDoubleTypeAnnotation
372
+ | NativeModuleFloatTypeAnnotation
373
+ | NativeModuleInt32TypeAnnotation
374
+ | NativeModuleNumberTypeAnnotation
375
+ | NativeModuleStringTypeAnnotation
376
+ | NativeModuleTypeAliasTypeAnnotation
377
+ | VoidTypeAnnotation;
378
+
379
+ export type NativeModuleEventEmitterTypeAnnotation =
380
+ | NativeModuleEventEmitterBaseTypeAnnotation
381
+ | {
382
+ type: 'ArrayTypeAnnotation',
383
+ elementType: NativeModuleEventEmitterBaseTypeAnnotation | {type: string},
384
+ };
385
+
369
386
  export type NativeModuleBaseTypeAnnotation =
370
387
  | NativeModuleStringTypeAnnotation
371
388
  | NativeModuleNumberTypeAnnotation
@@ -393,7 +410,8 @@ export type NativeModuleReturnTypeAnnotation =
393
410
  export type NativeModuleTypeAnnotation =
394
411
  | NativeModuleBaseTypeAnnotation
395
412
  | NativeModuleParamOnlyTypeAnnotation
396
- | NativeModuleReturnOnlyTypeAnnotation;
413
+ | NativeModuleReturnOnlyTypeAnnotation
414
+ | NativeModuleEventEmitterTypeAnnotation;
397
415
 
398
416
  type NativeModuleParamOnlyTypeAnnotation = NativeModuleFunctionTypeAnnotation;
399
417
 
@@ -86,7 +86,7 @@ class UnsupportedModuleEventEmitterPropertyParserError extends ParserError {
86
86
  message += `'${propertyValue}' must non nullable.`;
87
87
  } else if (untyped) {
88
88
  message += `'${propertyValue}' must have a concrete or void eventType.`;
89
- } else if (cxxOnly) {
89
+ } else if (!cxxOnly) {
90
90
  message += `'${propertyValue}' is only supported in C++ Turbo Modules.`;
91
91
  }
92
92
  super(nativeModuleName, propertyValue, message);
@@ -107,7 +107,7 @@ class UnsupportedModuleEventEmitterPropertyParserError extends ParserError {
107
107
  message += `'${propertyValue}' must non nullable.`;
108
108
  } else if (untyped) {
109
109
  message += `'${propertyValue}' must have a concrete or void eventType.`;
110
- } else if (cxxOnly) {
110
+ } else if (!cxxOnly) {
111
111
  message += `'${propertyValue}' is only supported in C++ Turbo Modules.`;
112
112
  }
113
113
  super(nativeModuleName, propertyValue, message);
@@ -598,6 +598,41 @@ export interface Spec extends TurboModule {
598
598
 
599
599
  export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
600
600
 
601
+ `;
602
+ const NATIVE_MODULE_WITH_EVENT_EMITTERS = `
603
+ /**
604
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
605
+ *
606
+ * This source code is licensed under the MIT license found in the
607
+ * LICENSE file in the root directory of this source tree.
608
+ *
609
+ * @flow strict-local
610
+ * @format
611
+ */
612
+
613
+ 'use strict';
614
+
615
+ import type {TurboModule} from '../RCTExport';
616
+ import type {EventEmitter} from '../CodegenTypes';
617
+ import * as TurboModuleRegistry from '../TurboModuleRegistry';
618
+
619
+ export type ObjectStruct = {
620
+ a: number,
621
+ b: string,
622
+ c?: ?string,
623
+ };
624
+
625
+ export interface Spec extends TurboModule {
626
+ +onEvent1: EventEmitter<void>;
627
+ +onEvent2: EventEmitter<string>;
628
+ +onEvent3: EventEmitter<number>;
629
+ +onEvent4: EventEmitter<boolean>;
630
+ +onEvent5: EventEmitter<ObjectStruct>;
631
+ +onEvent6: EventEmitter<ObjectStruct[]>;
632
+ }
633
+
634
+ export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModuleCxx');
635
+
601
636
  `;
602
637
  const ANDROID_ONLY_NATIVE_MODULE = `
603
638
  /**
@@ -788,6 +823,7 @@ module.exports = {
788
823
  NATIVE_MODULE_WITH_BASIC_PARAM_TYPES,
789
824
  NATIVE_MODULE_WITH_CALLBACK,
790
825
  NATIVE_MODULE_WITH_UNION,
826
+ NATIVE_MODULE_WITH_EVENT_EMITTERS,
791
827
  EMPTY_NATIVE_MODULE,
792
828
  ANDROID_ONLY_NATIVE_MODULE,
793
829
  IOS_ONLY_NATIVE_MODULE,
@@ -620,6 +620,42 @@ export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
620
620
 
621
621
  `;
622
622
 
623
+ const NATIVE_MODULE_WITH_EVENT_EMITTERS = `
624
+ /**
625
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
626
+ *
627
+ * This source code is licensed under the MIT license found in the
628
+ * LICENSE file in the root directory of this source tree.
629
+ *
630
+ * @flow strict-local
631
+ * @format
632
+ */
633
+
634
+ 'use strict';
635
+
636
+ import type {TurboModule} from '../RCTExport';
637
+ import type {EventEmitter} from '../CodegenTypes';
638
+ import * as TurboModuleRegistry from '../TurboModuleRegistry';
639
+
640
+ export type ObjectStruct = {
641
+ a: number,
642
+ b: string,
643
+ c?: ?string,
644
+ };
645
+
646
+ export interface Spec extends TurboModule {
647
+ +onEvent1: EventEmitter<void>;
648
+ +onEvent2: EventEmitter<string>;
649
+ +onEvent3: EventEmitter<number>;
650
+ +onEvent4: EventEmitter<boolean>;
651
+ +onEvent5: EventEmitter<ObjectStruct>;
652
+ +onEvent6: EventEmitter<ObjectStruct[]>;
653
+ }
654
+
655
+ export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModuleCxx');
656
+
657
+ `;
658
+
623
659
  const ANDROID_ONLY_NATIVE_MODULE = `
624
660
  /**
625
661
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -813,6 +849,7 @@ module.exports = {
813
849
  NATIVE_MODULE_WITH_BASIC_PARAM_TYPES,
814
850
  NATIVE_MODULE_WITH_CALLBACK,
815
851
  NATIVE_MODULE_WITH_UNION,
852
+ NATIVE_MODULE_WITH_EVENT_EMITTERS,
816
853
  EMPTY_NATIVE_MODULE,
817
854
  ANDROID_ONLY_NATIVE_MODULE,
818
855
  IOS_ONLY_NATIVE_MODULE,
@@ -98,6 +98,7 @@ const _require3 = require('../../parsers-primitives'),
98
98
  emitPromise = _require3.emitPromise,
99
99
  emitRootTag = _require3.emitRootTag,
100
100
  emitUnion = _require3.emitUnion,
101
+ translateArrayTypeAnnotation = _require3.translateArrayTypeAnnotation,
101
102
  typeAliasResolution = _require3.typeAliasResolution,
102
103
  typeEnumResolution = _require3.typeEnumResolution;
103
104
  function translateTypeAnnotation(
@@ -123,6 +124,20 @@ function translateTypeAnnotation(
123
124
  typeAnnotation = _resolveTypeAnnotatio.typeAnnotation,
124
125
  typeResolutionStatus = _resolveTypeAnnotatio.typeResolutionStatus;
125
126
  switch (typeAnnotation.type) {
127
+ case 'ArrayTypeAnnotation': {
128
+ return translateArrayTypeAnnotation(
129
+ hasteModuleName,
130
+ types,
131
+ aliasMap,
132
+ enumMap,
133
+ cxxOnly,
134
+ 'Array',
135
+ typeAnnotation.elementType,
136
+ nullable,
137
+ translateTypeAnnotation,
138
+ parser,
139
+ );
140
+ }
126
141
  case 'GenericTypeAnnotation': {
127
142
  switch (parser.getTypeAnnotationName(typeAnnotation)) {
128
143
  case 'RootTag': {
@@ -40,6 +40,7 @@ const {
40
40
  emitPromise,
41
41
  emitRootTag,
42
42
  emitUnion,
43
+ translateArrayTypeAnnotation,
43
44
  typeAliasResolution,
44
45
  typeEnumResolution,
45
46
  } = require('../../parsers-primitives');
@@ -62,6 +63,20 @@ function translateTypeAnnotation(
62
63
  resolveTypeAnnotationFN(flowTypeAnnotation, types, parser);
63
64
 
64
65
  switch (typeAnnotation.type) {
66
+ case 'ArrayTypeAnnotation': {
67
+ return translateArrayTypeAnnotation(
68
+ hasteModuleName,
69
+ types,
70
+ aliasMap,
71
+ enumMap,
72
+ cxxOnly,
73
+ 'Array',
74
+ typeAnnotation.elementType,
75
+ nullable,
76
+ translateTypeAnnotation,
77
+ parser,
78
+ );
79
+ }
65
80
  case 'GenericTypeAnnotation': {
66
81
  switch (parser.getTypeAnnotationName(typeAnnotation)) {
67
82
  case 'RootTag': {
@@ -563,8 +563,11 @@ function buildEventEmitterSchema(
563
563
  translateTypeAnnotation,
564
564
  parser,
565
565
  ) {
566
- let key = property.key,
567
- value = property.value;
566
+ const key = property.key;
567
+ const value =
568
+ parser.language() === 'TypeScript'
569
+ ? property.typeAnnotation.typeAnnotation
570
+ : property.value;
568
571
  const eventemitterName = key.name;
569
572
  const resolveTypeAnnotationFN = parser.getResolveTypeAnnotationFN();
570
573
  const _unwrapNullable7 = unwrapNullable(value),
@@ -573,8 +576,11 @@ function buildEventEmitterSchema(
573
576
  typeAnnotationNullable = _unwrapNullable8[1];
574
577
  const typeAnnotationUntyped =
575
578
  value.typeParameters.params.length === 1 &&
576
- value.typeParameters.params[0].type === 'ObjectTypeAnnotation' &&
577
- value.typeParameters.params[0].properties.length === 0;
579
+ parser.language() === 'TypeScript'
580
+ ? value.typeParameters.params[0].type === 'TSTypeLiteral' &&
581
+ value.typeParameters.params[0].members.length === 0
582
+ : value.typeParameters.params[0].type === 'ObjectTypeAnnotation' &&
583
+ value.typeParameters.params[0].properties.length === 0;
578
584
  throwIfEventEmitterTypeIsUnsupported(
579
585
  hasteModuleName,
580
586
  key.name,
@@ -596,14 +602,22 @@ function buildEventEmitterSchema(
596
602
  parser,
597
603
  eventTypeResolutionStatus.nullable,
598
604
  );
605
+ const eventTypeAnnotation = translateTypeAnnotation(
606
+ hasteModuleName,
607
+ typeAnnotation.typeParameters.params[0],
608
+ types,
609
+ aliasMap,
610
+ enumMap,
611
+ tryParse,
612
+ cxxOnly,
613
+ parser,
614
+ );
599
615
  return {
600
616
  name: eventemitterName,
601
617
  optional: false,
602
618
  typeAnnotation: {
603
619
  type: 'EventEmitterTypeAnnotation',
604
- typeAnnotation: {
605
- type: eventTypeResolutionStatus.typeAnnotation.type,
606
- },
620
+ typeAnnotation: eventTypeAnnotation,
607
621
  },
608
622
  };
609
623
  }
@@ -817,23 +831,38 @@ const buildModuleSchema = (
817
831
  property.type === 'TSMethodSignature',
818
832
  )
819
833
  .map(property => {
820
- var _property$value, _property$value2;
834
+ var _property$typeAnnotat, _property$value, _property$value2;
821
835
  const enumMap = {};
822
836
  const isEventEmitter =
823
- (property === null ||
824
- property === void 0 ||
825
- (_property$value = property.value) === null ||
826
- _property$value === void 0
827
- ? void 0
828
- : _property$value.type) === 'GenericTypeAnnotation' &&
829
- (property === null ||
830
- property === void 0 ||
831
- (_property$value2 = property.value) === null ||
832
- _property$value2 === void 0 ||
833
- (_property$value2 = _property$value2.id) === null ||
834
- _property$value2 === void 0
835
- ? void 0
836
- : _property$value2.name) === 'EventEmitter';
837
+ language === 'TypeScript'
838
+ ? (property === null || property === void 0
839
+ ? void 0
840
+ : property.type) === 'TSPropertySignature' &&
841
+ (property === null ||
842
+ property === void 0 ||
843
+ (_property$typeAnnotat = property.typeAnnotation) === null ||
844
+ _property$typeAnnotat === void 0 ||
845
+ (_property$typeAnnotat = _property$typeAnnotat.typeAnnotation) ===
846
+ null ||
847
+ _property$typeAnnotat === void 0 ||
848
+ (_property$typeAnnotat = _property$typeAnnotat.typeName) === null ||
849
+ _property$typeAnnotat === void 0
850
+ ? void 0
851
+ : _property$typeAnnotat.name) === 'EventEmitter'
852
+ : (property === null ||
853
+ property === void 0 ||
854
+ (_property$value = property.value) === null ||
855
+ _property$value === void 0
856
+ ? void 0
857
+ : _property$value.type) === 'GenericTypeAnnotation' &&
858
+ (property === null ||
859
+ property === void 0 ||
860
+ (_property$value2 = property.value) === null ||
861
+ _property$value2 === void 0 ||
862
+ (_property$value2 = _property$value2.id) === null ||
863
+ _property$value2 === void 0
864
+ ? void 0
865
+ : _property$value2.name) === 'EventEmitter';
837
866
  return tryParse(() => ({
838
867
  aliasMap,
839
868
  enumMap,
@@ -489,15 +489,22 @@ function buildEventEmitterSchema(
489
489
  translateTypeAnnotation: $FlowFixMe,
490
490
  parser: Parser,
491
491
  ): NativeModuleEventEmitterShape {
492
- let {key, value} = property;
493
- const eventemitterName: string = key.name;
492
+ const {key} = property;
493
+ const value =
494
+ parser.language() === 'TypeScript'
495
+ ? property.typeAnnotation.typeAnnotation
496
+ : property.value;
494
497
 
498
+ const eventemitterName: string = key.name;
495
499
  const resolveTypeAnnotationFN = parser.getResolveTypeAnnotationFN();
496
500
  const [typeAnnotation, typeAnnotationNullable] = unwrapNullable(value);
497
501
  const typeAnnotationUntyped =
498
502
  value.typeParameters.params.length === 1 &&
499
- value.typeParameters.params[0].type === 'ObjectTypeAnnotation' &&
500
- value.typeParameters.params[0].properties.length === 0;
503
+ parser.language() === 'TypeScript'
504
+ ? value.typeParameters.params[0].type === 'TSTypeLiteral' &&
505
+ value.typeParameters.params[0].members.length === 0
506
+ : value.typeParameters.params[0].type === 'ObjectTypeAnnotation' &&
507
+ value.typeParameters.params[0].properties.length === 0;
501
508
 
502
509
  throwIfEventEmitterTypeIsUnsupported(
503
510
  hasteModuleName,
@@ -520,12 +527,24 @@ function buildEventEmitterSchema(
520
527
  parser,
521
528
  eventTypeResolutionStatus.nullable,
522
529
  );
530
+
531
+ const eventTypeAnnotation = translateTypeAnnotation(
532
+ hasteModuleName,
533
+ typeAnnotation.typeParameters.params[0],
534
+ types,
535
+ aliasMap,
536
+ enumMap,
537
+ tryParse,
538
+ cxxOnly,
539
+ parser,
540
+ );
541
+
523
542
  return {
524
543
  name: eventemitterName,
525
544
  optional: false,
526
545
  typeAnnotation: {
527
546
  type: 'EventEmitterTypeAnnotation',
528
- typeAnnotation: {type: eventTypeResolutionStatus.typeAnnotation.type},
547
+ typeAnnotation: eventTypeAnnotation,
529
548
  },
530
549
  };
531
550
  }
@@ -775,7 +794,6 @@ const buildModuleSchema = (
775
794
  parser,
776
795
  )
777
796
  : {};
778
-
779
797
  const properties: $ReadOnlyArray<$FlowFixMe> =
780
798
  language === 'Flow' ? moduleSpec.body.properties : moduleSpec.body.body;
781
799
 
@@ -798,8 +816,12 @@ const buildModuleSchema = (
798
816
  }>(property => {
799
817
  const enumMap: {...NativeModuleEnumMap} = {};
800
818
  const isEventEmitter =
801
- property?.value?.type === 'GenericTypeAnnotation' &&
802
- property?.value?.id?.name === 'EventEmitter';
819
+ language === 'TypeScript'
820
+ ? property?.type === 'TSPropertySignature' &&
821
+ property?.typeAnnotation?.typeAnnotation?.typeName?.name ===
822
+ 'EventEmitter'
823
+ : property?.value?.type === 'GenericTypeAnnotation' &&
824
+ property?.value?.id?.name === 'EventEmitter';
803
825
  return tryParse(() => ({
804
826
  aliasMap,
805
827
  enumMap,
@@ -695,6 +695,37 @@ export interface Spec extends TurboModule {
695
695
 
696
696
  export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
697
697
 
698
+ `;
699
+ const NATIVE_MODULE_WITH_EVENT_EMITTERS = `
700
+ /**
701
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
702
+ *
703
+ * This source code is licensed under the MIT license found in the
704
+ * LICENSE file in the root directory of this source tree.
705
+ *
706
+ * @format
707
+ */
708
+
709
+ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
710
+ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
711
+
712
+ export type ObjectStruct = {
713
+ a: number;
714
+ b: string;
715
+ c?: string | null;
716
+ };
717
+
718
+ export interface Spec extends TurboModule {
719
+ readonly onEvent1: EventEmitter<void>;
720
+ readonly onEvent2: EventEmitter<string>;
721
+ readonly onEvent3: EventEmitter<number>;
722
+ readonly onEvent4: EventEmitter<boolean>;
723
+ readonly onEvent5: EventEmitter<ObjectStruct>;
724
+ readonly onEvent6: EventEmitter<ObjectStruct[]>;
725
+ }
726
+
727
+ export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModuleCxx');
728
+
698
729
  `;
699
730
  const ANDROID_ONLY_NATIVE_MODULE = `
700
731
  /**
@@ -845,6 +876,7 @@ module.exports = {
845
876
  NATIVE_MODULE_WITH_BASIC_PARAM_TYPES,
846
877
  NATIVE_MODULE_WITH_CALLBACK,
847
878
  NATIVE_MODULE_WITH_UNION,
879
+ NATIVE_MODULE_WITH_EVENT_EMITTERS,
848
880
  EMPTY_NATIVE_MODULE,
849
881
  ANDROID_ONLY_NATIVE_MODULE,
850
882
  IOS_ONLY_NATIVE_MODULE,
@@ -723,6 +723,38 @@ export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
723
723
 
724
724
  `;
725
725
 
726
+ const NATIVE_MODULE_WITH_EVENT_EMITTERS = `
727
+ /**
728
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
729
+ *
730
+ * This source code is licensed under the MIT license found in the
731
+ * LICENSE file in the root directory of this source tree.
732
+ *
733
+ * @format
734
+ */
735
+
736
+ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
737
+ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
738
+
739
+ export type ObjectStruct = {
740
+ a: number;
741
+ b: string;
742
+ c?: string | null;
743
+ };
744
+
745
+ export interface Spec extends TurboModule {
746
+ readonly onEvent1: EventEmitter<void>;
747
+ readonly onEvent2: EventEmitter<string>;
748
+ readonly onEvent3: EventEmitter<number>;
749
+ readonly onEvent4: EventEmitter<boolean>;
750
+ readonly onEvent5: EventEmitter<ObjectStruct>;
751
+ readonly onEvent6: EventEmitter<ObjectStruct[]>;
752
+ }
753
+
754
+ export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModuleCxx');
755
+
756
+ `;
757
+
726
758
  const ANDROID_ONLY_NATIVE_MODULE = `
727
759
  /**
728
760
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -875,6 +907,7 @@ module.exports = {
875
907
  NATIVE_MODULE_WITH_BASIC_PARAM_TYPES,
876
908
  NATIVE_MODULE_WITH_CALLBACK,
877
909
  NATIVE_MODULE_WITH_UNION,
910
+ NATIVE_MODULE_WITH_EVENT_EMITTERS,
878
911
  EMPTY_NATIVE_MODULE,
879
912
  ANDROID_ONLY_NATIVE_MODULE,
880
913
  IOS_ONLY_NATIVE_MODULE,
@@ -334,6 +334,8 @@ class TypeScriptParser {
334
334
  }
335
335
  convertKeywordToTypeAnnotation(keyword) {
336
336
  switch (keyword) {
337
+ case 'TSArrayType':
338
+ return 'ArrayTypeAnnotation';
337
339
  case 'TSBooleanKeyword':
338
340
  return 'BooleanTypeAnnotation';
339
341
  case 'TSNumberKeyword':
@@ -342,6 +344,8 @@ class TypeScriptParser {
342
344
  return 'VoidTypeAnnotation';
343
345
  case 'TSStringKeyword':
344
346
  return 'StringTypeAnnotation';
347
+ case 'TSTypeLiteral':
348
+ return 'ObjectTypeAnnotation';
345
349
  case 'TSUnknownKeyword':
346
350
  return 'MixedTypeAnnotation';
347
351
  }
@@ -337,6 +337,8 @@ class TypeScriptParser implements Parser {
337
337
 
338
338
  convertKeywordToTypeAnnotation(keyword: string): string {
339
339
  switch (keyword) {
340
+ case 'TSArrayType':
341
+ return 'ArrayTypeAnnotation';
340
342
  case 'TSBooleanKeyword':
341
343
  return 'BooleanTypeAnnotation';
342
344
  case 'TSNumberKeyword':
@@ -345,6 +347,8 @@ class TypeScriptParser implements Parser {
345
347
  return 'VoidTypeAnnotation';
346
348
  case 'TSStringKeyword':
347
349
  return 'StringTypeAnnotation';
350
+ case 'TSTypeLiteral':
351
+ return 'ObjectTypeAnnotation';
348
352
  case 'TSUnknownKeyword':
349
353
  return 'MixedTypeAnnotation';
350
354
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native/codegen",
3
- "version": "0.75.0-rc.1",
3
+ "version": "0.76.0-nightly-20240627-TEMP",
4
4
  "description": "Code generation tools for React Native",
5
5
  "license": "MIT",
6
6
  "repository": {