@react-native/codegen 0.84.0-rc.0 → 0.85.0-nightly-20260108-1236b6be4

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.
Files changed (26) hide show
  1. package/lib/CodegenSchema.js.flow +47 -47
  2. package/lib/generators/RNCodegen.js.flow +5 -5
  3. package/lib/generators/components/GenerateEventEmitterCpp.js.flow +1 -1
  4. package/lib/generators/components/GenerateEventEmitterH.js.flow +1 -1
  5. package/lib/generators/components/GeneratePropsJavaPojo/PojoCollector.js.flow +10 -10
  6. package/lib/generators/components/GenerateTests.js.flow +1 -1
  7. package/lib/generators/modules/GenerateModuleH.js.flow +3 -3
  8. package/lib/generators/modules/GenerateModuleJavaSpec.js.flow +2 -2
  9. package/lib/generators/modules/GenerateModuleJniCpp.js.flow +4 -4
  10. package/lib/generators/modules/GenerateModuleJniH.js.flow +3 -3
  11. package/lib/generators/modules/GenerateModuleObjCpp/StructCollector.js.flow +4 -4
  12. package/lib/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js.flow +2 -2
  13. package/lib/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js.flow +2 -2
  14. package/lib/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js.flow +1 -1
  15. package/lib/generators/modules/GenerateModuleObjCpp/index.js.flow +3 -3
  16. package/lib/generators/modules/GenerateModuleObjCpp/serializeMethod.js.flow +4 -4
  17. package/lib/generators/modules/GenerateModuleObjCpp/source/serializeModule.js.flow +4 -4
  18. package/lib/generators/modules/Utils.js.flow +1 -1
  19. package/lib/parsers/flow/components/commands.js.flow +1 -1
  20. package/lib/parsers/flow/parseFlowAndThrowErrors.js.flow +1 -1
  21. package/lib/parsers/parsers-commons.js.flow +1 -1
  22. package/lib/parsers/parsers-primitives.js +1 -0
  23. package/lib/parsers/parsers-primitives.js.flow +1 -0
  24. package/lib/parsers/schema.js.flow +1 -1
  25. package/lib/parsers/utils.js.flow +3 -3
  26. package/package.json +1 -1
@@ -12,9 +12,9 @@
12
12
 
13
13
  export type PlatformType = 'iOS' | 'android';
14
14
 
15
- export type SchemaType = $ReadOnly<{
15
+ export type SchemaType = Readonly<{
16
16
  libraryName?: string,
17
- modules: $ReadOnly<{
17
+ modules: Readonly<{
18
18
  [hasteModuleName: string]: ComponentSchema | NativeModuleSchema,
19
19
  }>,
20
20
  }>;
@@ -22,41 +22,41 @@ export type SchemaType = $ReadOnly<{
22
22
  /**
23
23
  * Component Type Annotations
24
24
  */
25
- export type DoubleTypeAnnotation = $ReadOnly<{
25
+ export type DoubleTypeAnnotation = Readonly<{
26
26
  type: 'DoubleTypeAnnotation',
27
27
  }>;
28
28
 
29
- export type FloatTypeAnnotation = $ReadOnly<{
29
+ export type FloatTypeAnnotation = Readonly<{
30
30
  type: 'FloatTypeAnnotation',
31
31
  }>;
32
32
 
33
- export type NumberTypeAnnotation = $ReadOnly<{
33
+ export type NumberTypeAnnotation = Readonly<{
34
34
  type: 'NumberTypeAnnotation',
35
35
  }>;
36
36
 
37
- export type BooleanTypeAnnotation = $ReadOnly<{
37
+ export type BooleanTypeAnnotation = Readonly<{
38
38
  type: 'BooleanTypeAnnotation',
39
39
  }>;
40
40
 
41
- export type Int32TypeAnnotation = $ReadOnly<{
41
+ export type Int32TypeAnnotation = Readonly<{
42
42
  type: 'Int32TypeAnnotation',
43
43
  }>;
44
44
 
45
- export type NumberLiteralTypeAnnotation = $ReadOnly<{
45
+ export type NumberLiteralTypeAnnotation = Readonly<{
46
46
  type: 'NumberLiteralTypeAnnotation',
47
47
  value: number,
48
48
  }>;
49
49
 
50
- export type StringTypeAnnotation = $ReadOnly<{
50
+ export type StringTypeAnnotation = Readonly<{
51
51
  type: 'StringTypeAnnotation',
52
52
  }>;
53
53
 
54
- export type StringLiteralTypeAnnotation = $ReadOnly<{
54
+ export type StringLiteralTypeAnnotation = Readonly<{
55
55
  type: 'StringLiteralTypeAnnotation',
56
56
  value: string,
57
57
  }>;
58
58
 
59
- export type BooleanLiteralTypeAnnotation = $ReadOnly<{
59
+ export type BooleanLiteralTypeAnnotation = Readonly<{
60
60
  type: 'BooleanLiteralTypeAnnotation',
61
61
  value: boolean,
62
62
  }>;
@@ -64,51 +64,51 @@ export type BooleanLiteralTypeAnnotation = $ReadOnly<{
64
64
  export type StringLiteralUnionTypeAnnotation =
65
65
  UnionTypeAnnotation<StringLiteralTypeAnnotation>;
66
66
 
67
- export type VoidTypeAnnotation = $ReadOnly<{
67
+ export type VoidTypeAnnotation = Readonly<{
68
68
  type: 'VoidTypeAnnotation',
69
69
  }>;
70
70
 
71
- export type ObjectTypeAnnotation<+T> = $ReadOnly<{
71
+ export type ObjectTypeAnnotation<+T> = Readonly<{
72
72
  type: 'ObjectTypeAnnotation',
73
73
  properties: $ReadOnlyArray<NamedShape<T>>,
74
74
  // metadata for objects that generated from interfaces
75
75
  baseTypes?: $ReadOnlyArray<string>,
76
76
  }>;
77
77
 
78
- export type UnionTypeAnnotation<+T> = $ReadOnly<{
78
+ export type UnionTypeAnnotation<+T> = Readonly<{
79
79
  type: 'UnionTypeAnnotation',
80
80
  types: $ReadOnlyArray<T>,
81
81
  }>;
82
82
 
83
- export type MixedTypeAnnotation = $ReadOnly<{
83
+ export type MixedTypeAnnotation = Readonly<{
84
84
  type: 'MixedTypeAnnotation',
85
85
  }>;
86
86
 
87
- export type EventEmitterTypeAnnotation = $ReadOnly<{
87
+ export type EventEmitterTypeAnnotation = Readonly<{
88
88
  type: 'EventEmitterTypeAnnotation',
89
89
  typeAnnotation: NativeModuleEventEmitterTypeAnnotation | $FlowFixMe,
90
90
  }>;
91
91
 
92
- type FunctionTypeAnnotation<+P, +R> = $ReadOnly<{
92
+ type FunctionTypeAnnotation<+P, +R> = Readonly<{
93
93
  type: 'FunctionTypeAnnotation',
94
94
  params: $ReadOnlyArray<NamedShape<P>>,
95
95
  returnTypeAnnotation: R,
96
96
  }>;
97
97
 
98
- export type NamedShape<+T> = $ReadOnly<{
98
+ export type NamedShape<+T> = Readonly<{
99
99
  name: string,
100
100
  optional: boolean,
101
101
  typeAnnotation: T,
102
102
  }>;
103
103
 
104
- export type ComponentSchema = $ReadOnly<{
104
+ export type ComponentSchema = Readonly<{
105
105
  type: 'Component',
106
- components: $ReadOnly<{
106
+ components: Readonly<{
107
107
  [componentName: string]: ComponentShape,
108
108
  }>,
109
109
  }>;
110
110
 
111
- export type ComponentShape = $ReadOnly<{
111
+ export type ComponentShape = Readonly<{
112
112
  ...OptionsShape,
113
113
  extendsProps: $ReadOnlyArray<ExtendsPropsShape>,
114
114
  events: $ReadOnlyArray<EventTypeShape>,
@@ -116,7 +116,7 @@ export type ComponentShape = $ReadOnly<{
116
116
  commands: $ReadOnlyArray<NamedShape<CommandTypeAnnotation>>,
117
117
  }>;
118
118
 
119
- export type OptionsShape = $ReadOnly<{
119
+ export type OptionsShape = Readonly<{
120
120
  // Use to generate only interfaces of components (C++ Props, C++ EventEmitters, JVM interfaces) and not their implementation.
121
121
  // This is useful for components that have a custom implementation of ShadowNode, ComponentDescriptor, State.
122
122
  interfaceOnly?: boolean,
@@ -134,17 +134,17 @@ export type OptionsShape = $ReadOnly<{
134
134
  generateOptionalObjectProperties?: boolean,
135
135
  }>;
136
136
 
137
- export type ExtendsPropsShape = $ReadOnly<{
137
+ export type ExtendsPropsShape = Readonly<{
138
138
  type: 'ReactNativeBuiltInType',
139
139
  knownTypeName: 'ReactNativeCoreViewProps',
140
140
  }>;
141
141
 
142
- export type EventTypeShape = $ReadOnly<{
142
+ export type EventTypeShape = Readonly<{
143
143
  name: string,
144
144
  bubblingType: 'direct' | 'bubble',
145
145
  optional: boolean,
146
146
  paperTopLevelNameDeprecated?: string,
147
- typeAnnotation: $ReadOnly<{
147
+ typeAnnotation: Readonly<{
148
148
  type: 'EventTypeAnnotation',
149
149
  argument?: ObjectTypeAnnotation<EventTypeAnnotation>,
150
150
  }>,
@@ -168,7 +168,7 @@ export type ComponentArrayTypeAnnotation = ArrayTypeAnnotation<
168
168
  | FloatTypeAnnotation
169
169
  | Int32TypeAnnotation
170
170
  | MixedTypeAnnotation
171
- | $ReadOnly<{
171
+ | Readonly<{
172
172
  type: 'StringEnumTypeAnnotation',
173
173
  default: string,
174
174
  options: $ReadOnlyArray<string>,
@@ -191,38 +191,38 @@ export type ComponentCommandArrayTypeAnnotation = ArrayTypeAnnotation<
191
191
  | MixedTypeAnnotation,
192
192
  >;
193
193
 
194
- export type ArrayTypeAnnotation<+T> = $ReadOnly<{
194
+ export type ArrayTypeAnnotation<+T> = Readonly<{
195
195
  type: 'ArrayTypeAnnotation',
196
196
  elementType: T,
197
197
  }>;
198
198
 
199
199
  export type PropTypeAnnotation =
200
- | $ReadOnly<{
200
+ | Readonly<{
201
201
  type: 'BooleanTypeAnnotation',
202
202
  default: boolean | null,
203
203
  }>
204
- | $ReadOnly<{
204
+ | Readonly<{
205
205
  type: 'StringTypeAnnotation',
206
206
  default: string | null,
207
207
  }>
208
- | $ReadOnly<{
208
+ | Readonly<{
209
209
  type: 'DoubleTypeAnnotation',
210
210
  default: number,
211
211
  }>
212
- | $ReadOnly<{
212
+ | Readonly<{
213
213
  type: 'FloatTypeAnnotation',
214
214
  default: number | null,
215
215
  }>
216
- | $ReadOnly<{
216
+ | Readonly<{
217
217
  type: 'Int32TypeAnnotation',
218
218
  default: number,
219
219
  }>
220
- | $ReadOnly<{
220
+ | Readonly<{
221
221
  type: 'StringEnumTypeAnnotation',
222
222
  default: string,
223
223
  options: $ReadOnlyArray<string>,
224
224
  }>
225
- | $ReadOnly<{
225
+ | Readonly<{
226
226
  type: 'Int32EnumTypeAnnotation',
227
227
  default: number,
228
228
  options: $ReadOnlyArray<number>,
@@ -232,7 +232,7 @@ export type PropTypeAnnotation =
232
232
  | ComponentArrayTypeAnnotation
233
233
  | MixedTypeAnnotation;
234
234
 
235
- export type ReservedPropTypeAnnotation = $ReadOnly<{
235
+ export type ReservedPropTypeAnnotation = Readonly<{
236
236
  type: 'ReservedPropTypeAnnotation',
237
237
  name:
238
238
  | 'ColorPrimitive'
@@ -257,7 +257,7 @@ export type CommandParamTypeAnnotation =
257
257
  | StringTypeAnnotation
258
258
  | ComponentCommandArrayTypeAnnotation;
259
259
 
260
- export type ReservedTypeAnnotation = $ReadOnly<{
260
+ export type ReservedTypeAnnotation = Readonly<{
261
261
  type: 'ReservedTypeAnnotation',
262
262
  name: 'RootTag', // Union with more custom types.
263
263
  }>;
@@ -269,12 +269,12 @@ export type Nullable<+T: NativeModuleTypeAnnotation> =
269
269
  | NullableTypeAnnotation<T>
270
270
  | T;
271
271
 
272
- export type NullableTypeAnnotation<+T: NativeModuleTypeAnnotation> = $ReadOnly<{
272
+ export type NullableTypeAnnotation<+T: NativeModuleTypeAnnotation> = Readonly<{
273
273
  type: 'NullableTypeAnnotation',
274
274
  typeAnnotation: T,
275
275
  }>;
276
276
 
277
- export type NativeModuleSchema = $ReadOnly<{
277
+ export type NativeModuleSchema = Readonly<{
278
278
  type: 'NativeModule',
279
279
  aliasMap: NativeModuleAliasMap,
280
280
  enumMap: NativeModuleEnumMap,
@@ -286,7 +286,7 @@ export type NativeModuleSchema = $ReadOnly<{
286
286
  excludedPlatforms?: $ReadOnlyArray<PlatformType>,
287
287
  }>;
288
288
 
289
- type NativeModuleSpec = $ReadOnly<{
289
+ type NativeModuleSpec = Readonly<{
290
290
  eventEmitters: $ReadOnlyArray<NativeModuleEventEmitterShape>,
291
291
  methods: $ReadOnlyArray<NativeModulePropertyShape>,
292
292
  }>;
@@ -298,11 +298,11 @@ export type NativeModulePropertyShape = NamedShape<
298
298
  Nullable<NativeModuleFunctionTypeAnnotation>,
299
299
  >;
300
300
 
301
- export type NativeModuleEnumMap = $ReadOnly<{
301
+ export type NativeModuleEnumMap = Readonly<{
302
302
  [enumName: string]: NativeModuleEnumDeclarationWithMembers,
303
303
  }>;
304
304
 
305
- export type NativeModuleAliasMap = $ReadOnly<{
305
+ export type NativeModuleAliasMap = Readonly<{
306
306
  [aliasName: string]: NativeModuleObjectTypeAnnotation,
307
307
  }>;
308
308
 
@@ -330,7 +330,7 @@ export type UnsafeAnyTypeAnnotation = {
330
330
  type: 'AnyTypeAnnotation',
331
331
  };
332
332
 
333
- export type NativeModuleNumberTypeAnnotation = $ReadOnly<{
333
+ export type NativeModuleNumberTypeAnnotation = Readonly<{
334
334
  type: 'NumberTypeAnnotation',
335
335
  }>;
336
336
 
@@ -343,7 +343,7 @@ export type NativeModuleEnumMemberType =
343
343
  | 'NumberTypeAnnotation'
344
344
  | 'StringTypeAnnotation';
345
345
 
346
- export type NativeModuleEnumDeclaration = $ReadOnly<{
346
+ export type NativeModuleEnumDeclaration = Readonly<{
347
347
  name: string,
348
348
  type: 'EnumDeclaration',
349
349
  memberType: NativeModuleEnumMemberType,
@@ -356,7 +356,7 @@ export type NativeModuleEnumDeclarationWithMembers = {
356
356
  members: $ReadOnlyArray<NativeModuleEnumMember>,
357
357
  };
358
358
 
359
- export type NativeModuleGenericObjectTypeAnnotation = $ReadOnly<{
359
+ export type NativeModuleGenericObjectTypeAnnotation = Readonly<{
360
360
  type: 'GenericObjectTypeAnnotation',
361
361
  // a dictionary type is codegen as "Object"
362
362
  // but we know all its members are in the same type
@@ -364,12 +364,12 @@ export type NativeModuleGenericObjectTypeAnnotation = $ReadOnly<{
364
364
  dictionaryValueType?: Nullable<NativeModuleTypeAnnotation>,
365
365
  }>;
366
366
 
367
- export type NativeModuleTypeAliasTypeAnnotation = $ReadOnly<{
367
+ export type NativeModuleTypeAliasTypeAnnotation = Readonly<{
368
368
  type: 'TypeAliasTypeAnnotation',
369
369
  name: string,
370
370
  }>;
371
371
 
372
- export type NativeModulePromiseTypeAnnotation = $ReadOnly<{
372
+ export type NativeModulePromiseTypeAnnotation = Readonly<{
373
373
  type: 'PromiseTypeAnnotation',
374
374
  elementType: VoidTypeAnnotation | Nullable<NativeModuleBaseTypeAnnotation>,
375
375
  }>;
@@ -386,7 +386,7 @@ export type NativeModuleUnionTypeAnnotationMemberType =
386
386
  export type NativeModuleUnionTypeAnnotation =
387
387
  UnionTypeAnnotation<NativeModuleUnionTypeAnnotationMemberType>;
388
388
 
389
- export type NativeModuleMixedTypeAnnotation = $ReadOnly<{
389
+ export type NativeModuleMixedTypeAnnotation = Readonly<{
390
390
  type: 'MixedTypeAnnotation',
391
391
  }>;
392
392
 
@@ -82,11 +82,11 @@ export type GenerateFunction = (
82
82
  includeGetDebugPropsImplementation?: boolean,
83
83
  ) => FilesOutput;
84
84
 
85
- export type LibraryGeneratorsFunctions = $ReadOnly<{
85
+ export type LibraryGeneratorsFunctions = Readonly<{
86
86
  [string]: Array<GenerateFunction>,
87
87
  }>;
88
88
 
89
- export type LibraryOptions = $ReadOnly<{
89
+ export type LibraryOptions = Readonly<{
90
90
  libraryName: string,
91
91
  schema: SchemaType,
92
92
  outputDirectory: string,
@@ -97,7 +97,7 @@ export type LibraryOptions = $ReadOnly<{
97
97
  libraryGenerators?: LibraryGeneratorsFunctions,
98
98
  }>;
99
99
 
100
- export type SchemasOptions = $ReadOnly<{
100
+ export type SchemasOptions = Readonly<{
101
101
  schemas: {[string]: SchemaType},
102
102
  outputDirectory: string,
103
103
  supportedApplePlatforms?: {[string]: {[string]: boolean}},
@@ -118,12 +118,12 @@ export type LibraryGenerators =
118
118
 
119
119
  export type SchemasGenerators = 'providerIOS';
120
120
 
121
- export type LibraryConfig = $ReadOnly<{
121
+ export type LibraryConfig = Readonly<{
122
122
  generators: Array<LibraryGenerators>,
123
123
  test?: boolean,
124
124
  }>;
125
125
 
126
- export type SchemasConfig = $ReadOnly<{
126
+ export type SchemasConfig = Readonly<{
127
127
  generators: Array<SchemasGenerators>,
128
128
  test?: boolean,
129
129
  }>;
@@ -25,7 +25,7 @@ const {IncludeTemplate, generateEventStructName} = require('./CppHelpers');
25
25
  // File path -> contents
26
26
  type FilesOutput = Map<string, string>;
27
27
 
28
- type ComponentCollection = $ReadOnly<{
28
+ type ComponentCollection = Readonly<{
29
29
  [component: string]: ComponentShape,
30
30
  ...
31
31
  }>;
@@ -31,7 +31,7 @@ const nullthrows = require('nullthrows');
31
31
  type FilesOutput = Map<string, string>;
32
32
  type StructsMap = Map<string, string>;
33
33
 
34
- type ComponentCollection = $ReadOnly<{
34
+ type ComponentCollection = Readonly<{
35
35
  [component: string]: ComponentShape,
36
36
  ...
37
37
  }>;
@@ -40,39 +40,39 @@ export type PojoTypeAliasAnnotation = {
40
40
  };
41
41
 
42
42
  export type PojoTypeAnnotation =
43
- | $ReadOnly<{
43
+ | Readonly<{
44
44
  type: 'BooleanTypeAnnotation',
45
45
  default: boolean | null,
46
46
  }>
47
- | $ReadOnly<{
47
+ | Readonly<{
48
48
  type: 'StringTypeAnnotation',
49
49
  default: string | null,
50
50
  }>
51
- | $ReadOnly<{
51
+ | Readonly<{
52
52
  type: 'DoubleTypeAnnotation',
53
53
  default: number,
54
54
  }>
55
- | $ReadOnly<{
55
+ | Readonly<{
56
56
  type: 'FloatTypeAnnotation',
57
57
  default: number | null,
58
58
  }>
59
- | $ReadOnly<{
59
+ | Readonly<{
60
60
  type: 'Int32TypeAnnotation',
61
61
  default: number,
62
62
  }>
63
- | $ReadOnly<{
63
+ | Readonly<{
64
64
  type: 'StringEnumTypeAnnotation',
65
65
  default: string,
66
66
  options: $ReadOnlyArray<string>,
67
67
  }>
68
- | $ReadOnly<{
68
+ | Readonly<{
69
69
  type: 'Int32EnumTypeAnnotation',
70
70
  default: number,
71
71
  options: $ReadOnlyArray<number>,
72
72
  }>
73
73
  | ReservedPropTypeAnnotation
74
74
  | PojoTypeAliasAnnotation
75
- | $ReadOnly<{
75
+ | Readonly<{
76
76
  type: 'ArrayTypeAnnotation',
77
77
  elementType:
78
78
  | BooleanTypeAnnotation
@@ -81,14 +81,14 @@ export type PojoTypeAnnotation =
81
81
  | FloatTypeAnnotation
82
82
  | Int32TypeAnnotation
83
83
  | MixedTypeAnnotation
84
- | $ReadOnly<{
84
+ | Readonly<{
85
85
  type: 'StringEnumTypeAnnotation',
86
86
  default: string,
87
87
  options: $ReadOnlyArray<string>,
88
88
  }>
89
89
  | PojoTypeAliasAnnotation
90
90
  | ReservedPropTypeAnnotation
91
- | $ReadOnly<{
91
+ | Readonly<{
92
92
  type: 'ArrayTypeAnnotation',
93
93
  elementType: PojoTypeAliasAnnotation,
94
94
  }>,
@@ -18,7 +18,7 @@ const {getImports} = require('./CppHelpers');
18
18
  type FilesOutput = Map<string, string>;
19
19
  type PropValueType = string | number | boolean;
20
20
 
21
- type TestCase = $ReadOnly<{
21
+ type TestCase = Readonly<{
22
22
  propName: string,
23
23
  propValue: ?PropValueType,
24
24
  testName?: string,
@@ -163,14 +163,14 @@ const ModuleSpecClassDeclarationTemplate = ({
163
163
  moduleEventEmitters,
164
164
  moduleFunctions,
165
165
  methods,
166
- }: $ReadOnly<{
166
+ }: Readonly<{
167
167
  hasteModuleName: string,
168
168
  moduleName: string,
169
169
  structs: string,
170
170
  enums: string,
171
171
  moduleEventEmitters: EventEmitterCpp[],
172
172
  moduleFunctions: string[],
173
- methods: $ReadOnlyArray<$ReadOnly<{methodName: string, paramCount: number}>>,
173
+ methods: $ReadOnlyArray<Readonly<{methodName: string, paramCount: number}>>,
174
174
  }>) => {
175
175
  return `${enums}${structs}
176
176
  template <typename T>
@@ -196,7 +196,7 @@ ${moduleFunctions.join('\n\n')}
196
196
 
197
197
  const FileTemplate = ({
198
198
  modules,
199
- }: $ReadOnly<{
199
+ }: Readonly<{
200
200
  modules: string[],
201
201
  }>) => {
202
202
  return `/**
@@ -30,7 +30,7 @@ const {createAliasResolver, getModules} = require('./Utils');
30
30
  type FilesOutput = Map<string, string>;
31
31
 
32
32
  function FileTemplate(
33
- config: $ReadOnly<{
33
+ config: Readonly<{
34
34
  packageName: string,
35
35
  className: string,
36
36
  jsName: string,
@@ -92,7 +92,7 @@ function EventEmitterTemplate(
92
92
  }
93
93
 
94
94
  function MethodTemplate(
95
- config: $ReadOnly<{
95
+ config: Readonly<{
96
96
  abstract: boolean,
97
97
  methodBody: ?string,
98
98
  methodJavaAnnotation: string,
@@ -42,7 +42,7 @@ const HostFunctionTemplate = ({
42
42
  propertyName,
43
43
  jniSignature,
44
44
  jsReturnType,
45
- }: $ReadOnly<{
45
+ }: Readonly<{
46
46
  hasteModuleName: string,
47
47
  propertyName: string,
48
48
  jniSignature: string,
@@ -58,7 +58,7 @@ const ModuleClassConstructorTemplate = ({
58
58
  hasteModuleName,
59
59
  eventEmitters,
60
60
  methods,
61
- }: $ReadOnly<{
61
+ }: Readonly<{
62
62
  hasteModuleName: string,
63
63
  eventEmitters: $ReadOnlyArray<NativeModuleEventEmitterShape>,
64
64
  methods: $ReadOnlyArray<{
@@ -94,7 +94,7 @@ ${methods
94
94
  const ModuleLookupTemplate = ({
95
95
  moduleName,
96
96
  hasteModuleName,
97
- }: $ReadOnly<{moduleName: string, hasteModuleName: string}>) => {
97
+ }: Readonly<{moduleName: string, hasteModuleName: string}>) => {
98
98
  return ` if (moduleName == "${moduleName}") {
99
99
  return std::make_shared<${hasteModuleName}SpecJSI>(params);
100
100
  }`;
@@ -105,7 +105,7 @@ const FileTemplate = ({
105
105
  include,
106
106
  modules,
107
107
  moduleLookups,
108
- }: $ReadOnly<{
108
+ }: Readonly<{
109
109
  libraryName: string,
110
110
  include: string,
111
111
  modules: string,
@@ -18,7 +18,7 @@ type FilesOutput = Map<string, string>;
18
18
 
19
19
  const ModuleClassDeclarationTemplate = ({
20
20
  hasteModuleName,
21
- }: $ReadOnly<{hasteModuleName: string}>) => {
21
+ }: Readonly<{hasteModuleName: string}>) => {
22
22
  return `/**
23
23
  * JNI C++ class for module '${hasteModuleName}'
24
24
  */
@@ -32,7 +32,7 @@ public:
32
32
  const HeaderFileTemplate = ({
33
33
  modules,
34
34
  libraryName,
35
- }: $ReadOnly<{modules: string, libraryName: string}>) => {
35
+ }: Readonly<{modules: string, libraryName: string}>) => {
36
36
  return `
37
37
  /**
38
38
  * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
@@ -64,7 +64,7 @@ std::shared_ptr<TurboModule> ${libraryName}_ModuleProvider(const std::string &mo
64
64
  const CMakeListsTemplate = ({
65
65
  libraryName,
66
66
  targetName,
67
- }: $ReadOnly<{libraryName: string, targetName: string}>) => {
67
+ }: Readonly<{libraryName: string, targetName: string}>) => {
68
68
  return `# Copyright (c) Meta Platforms, Inc. and affiliates.
69
69
  #
70
70
  # This source code is licensed under the MIT license found in the
@@ -44,13 +44,13 @@ const {
44
44
 
45
45
  type StructContext = 'CONSTANTS' | 'REGULAR';
46
46
 
47
- export type RegularStruct = $ReadOnly<{
47
+ export type RegularStruct = Readonly<{
48
48
  context: 'REGULAR',
49
49
  name: string,
50
50
  properties: $ReadOnlyArray<StructProperty>,
51
51
  }>;
52
52
 
53
- export type ConstantsStruct = $ReadOnly<{
53
+ export type ConstantsStruct = Readonly<{
54
54
  context: 'CONSTANTS',
55
55
  name: string,
56
56
  properties: $ReadOnlyArray<StructProperty>,
@@ -58,7 +58,7 @@ export type ConstantsStruct = $ReadOnly<{
58
58
 
59
59
  export type Struct = RegularStruct | ConstantsStruct;
60
60
 
61
- export type StructProperty = $ReadOnly<{
61
+ export type StructProperty = Readonly<{
62
62
  name: string,
63
63
  optional: boolean,
64
64
  typeAnnotation: Nullable<StructTypeAnnotation>,
@@ -200,7 +200,7 @@ class StructCollector {
200
200
  ): void {
201
201
  // $FlowFixMe[missing-type-arg]
202
202
  const properties = objectTypeAnnotation.properties.map<
203
- $ReadOnly<{
203
+ Readonly<{
204
204
  name: string,
205
205
  optional: boolean,
206
206
  typeAnnotation: Nullable<StructTypeAnnotation>,
@@ -26,7 +26,7 @@ const StructTemplate = ({
26
26
  hasteModuleName,
27
27
  structName,
28
28
  builderInputProps,
29
- }: $ReadOnly<{
29
+ }: Readonly<{
30
30
  hasteModuleName: string,
31
31
  structName: string,
32
32
  builderInputProps: string,
@@ -65,7 +65,7 @@ const MethodTemplate = ({
65
65
  hasteModuleName,
66
66
  structName,
67
67
  properties,
68
- }: $ReadOnly<{
68
+ }: Readonly<{
69
69
  hasteModuleName: string,
70
70
  structName: string,
71
71
  properties: string,
@@ -26,7 +26,7 @@ const StructTemplate = ({
26
26
  hasteModuleName,
27
27
  structName,
28
28
  structProperties,
29
- }: $ReadOnly<{
29
+ }: Readonly<{
30
30
  hasteModuleName: string,
31
31
  structName: string,
32
32
  structProperties: string,
@@ -53,7 +53,7 @@ const MethodTemplate = ({
53
53
  structName,
54
54
  propertyName,
55
55
  safePropertyName,
56
- }: $ReadOnly<{
56
+ }: Readonly<{
57
57
  returnType: string,
58
58
  returnValue: string,
59
59
  hasteModuleName: string,
@@ -15,7 +15,7 @@ import type {Struct} from '../StructCollector';
15
15
  const {serializeConstantsStruct} = require('./serializeConstantsStruct');
16
16
  const {serializeRegularStruct} = require('./serializeRegularStruct');
17
17
 
18
- export type StructSerilizationOutput = $ReadOnly<{
18
+ export type StructSerilizationOutput = Readonly<{
19
19
  methods: string,
20
20
  declaration: string,
21
21
  }>;
@@ -27,7 +27,7 @@ const ModuleDeclarationTemplate = ({
27
27
  structDeclarations,
28
28
  eventEmitters,
29
29
  protocolMethods,
30
- }: $ReadOnly<{
30
+ }: Readonly<{
31
31
  hasteModuleName: string,
32
32
  structDeclarations: string,
33
33
  eventEmitters: string,
@@ -63,7 +63,7 @@ const HeaderFileTemplate = ({
63
63
  moduleDeclarations,
64
64
  structInlineMethods,
65
65
  assumeNonnull,
66
- }: $ReadOnly<{
66
+ }: Readonly<{
67
67
  headerFileName: string,
68
68
  moduleDeclarations: string,
69
69
  structInlineMethods: string,
@@ -118,7 +118,7 @@ const HeaderFileTemplate = ({
118
118
  const SourceFileTemplate = ({
119
119
  headerFileName,
120
120
  moduleImplementations,
121
- }: $ReadOnly<{
121
+ }: Readonly<{
122
122
  headerFileName: string,
123
123
  moduleImplementations: string,
124
124
  }>) => `/**
@@ -33,13 +33,13 @@ const ProtocolMethodTemplate = ({
33
33
  returnObjCType,
34
34
  methodName,
35
35
  params,
36
- }: $ReadOnly<{
36
+ }: Readonly<{
37
37
  returnObjCType: string,
38
38
  methodName: string,
39
39
  params: string,
40
40
  }>) => `- (${returnObjCType})${methodName}${params};`;
41
41
 
42
- export type StructParameterRecord = $ReadOnly<{
42
+ export type StructParameterRecord = Readonly<{
43
43
  paramIndex: number,
44
44
  structName: string,
45
45
  }>;
@@ -53,7 +53,7 @@ type ReturnJSType =
53
53
  | 'NumberKind'
54
54
  | 'StringKind';
55
55
 
56
- export type MethodSerializationOutput = $ReadOnly<{
56
+ export type MethodSerializationOutput = Readonly<{
57
57
  methodName: string,
58
58
  protocolMethod: string,
59
59
  selector: string,
@@ -186,7 +186,7 @@ function getParamObjCType(
186
186
  structName: string,
187
187
  structCollector: StructCollector,
188
188
  resolveAlias: AliasResolver,
189
- ): $ReadOnly<{objCType: string, isStruct: boolean}> {
189
+ ): Readonly<{objCType: string, isStruct: boolean}> {
190
190
  const {name: paramName, typeAnnotation: nullableTypeAnnotation} = param;
191
191
  const [typeAnnotation, nullable] = unwrapNullable(nullableTypeAnnotation);
192
192
  const isRequired = !param.optional && !nullable;
@@ -27,7 +27,7 @@ const ModuleTemplate = ({
27
27
  moduleName,
28
28
  eventEmitters,
29
29
  methodSerializationOutputs,
30
- }: $ReadOnly<{
30
+ }: Readonly<{
31
31
  hasteModuleName: string,
32
32
  structs: $ReadOnlyArray<Struct>,
33
33
  moduleName: string,
@@ -96,7 +96,7 @@ namespace facebook::react {
96
96
  const RCTCxxConvertCategoryTemplate = ({
97
97
  hasteModuleName,
98
98
  structName,
99
- }: $ReadOnly<{
99
+ }: Readonly<{
100
100
  hasteModuleName: string,
101
101
  structName: string,
102
102
  }>) => `@implementation RCTCxxConvert (${hasteModuleName}_${structName})
@@ -111,7 +111,7 @@ const InlineHostFunctionTemplate = ({
111
111
  methodName,
112
112
  returnJSType,
113
113
  selector,
114
- }: $ReadOnly<{
114
+ }: Readonly<{
115
115
  hasteModuleName: string,
116
116
  methodName: string,
117
117
  returnJSType: string,
@@ -126,7 +126,7 @@ const MethodMapEntryTemplate = ({
126
126
  methodName,
127
127
  structParamRecords,
128
128
  argCount,
129
- }: $ReadOnly<{
129
+ }: Readonly<{
130
130
  hasteModuleName: string,
131
131
  methodName: string,
132
132
  structParamRecords: $ReadOnlyArray<StructParameterRecord>,
@@ -36,7 +36,7 @@ function createAliasResolver(aliasMap: NativeModuleAliasMap): AliasResolver {
36
36
 
37
37
  function getModules(
38
38
  schema: SchemaType,
39
- ): $ReadOnly<{[hasteModuleName: string]: NativeModuleSchema}> {
39
+ ): Readonly<{[hasteModuleName: string]: NativeModuleSchema}> {
40
40
  return Object.keys(schema.modules).reduce<{[string]: NativeModuleSchema}>(
41
41
  (modules, hasteModuleName: string) => {
42
42
  const module = schema.modules[hasteModuleName];
@@ -28,7 +28,7 @@ function buildCommandSchema(
28
28
  property: EventTypeAST,
29
29
  types: TypeDeclarationMap,
30
30
  parser: Parser,
31
- ): $ReadOnly<{
31
+ ): Readonly<{
32
32
  name: string,
33
33
  optional: boolean,
34
34
  typeAnnotation: {
@@ -16,7 +16,7 @@ const hermesParser = require('hermes-parser');
16
16
 
17
17
  function parseFlowAndThrowErrors(
18
18
  code: string,
19
- options: $ReadOnly<{filename?: ?string}> = {},
19
+ options: Readonly<{filename?: ?string}> = {},
20
20
  ): ESTreeProgram {
21
21
  let ast;
22
22
  try {
@@ -77,7 +77,7 @@ const {
77
77
  } = require('./utils');
78
78
  const invariant = require('invariant');
79
79
 
80
- export type CommandOptions = $ReadOnly<{
80
+ export type CommandOptions = Readonly<{
81
81
  supportedCommands: $ReadOnlyArray<string>,
82
82
  }>;
83
83
 
@@ -537,6 +537,7 @@ function emitCommonTypes(
537
537
  MixedTypeAnnotation: cxxOnly ? emitMixed : emitGenericObject,
538
538
  UnsafeMixed: cxxOnly ? emitMixed : emitGenericObject,
539
539
  unknown: cxxOnly ? emitMixed : emitGenericObject,
540
+ UnknownTypeAnnotation: cxxOnly ? emitMixed : emitGenericObject,
540
541
  };
541
542
  const typeAnnotationName = parser.convertKeywordToTypeAnnotation(
542
543
  typeAnnotation.type,
@@ -665,6 +665,7 @@ function emitCommonTypes(
665
665
  MixedTypeAnnotation: cxxOnly ? emitMixed : emitGenericObject,
666
666
  UnsafeMixed: cxxOnly ? emitMixed : emitGenericObject,
667
667
  unknown: cxxOnly ? emitMixed : emitGenericObject,
668
+ UnknownTypeAnnotation: cxxOnly ? emitMixed : emitGenericObject,
668
669
  };
669
670
 
670
671
  const typeAnnotationName = parser.convertKeywordToTypeAnnotation(
@@ -20,7 +20,7 @@ import type {
20
20
  SchemaType,
21
21
  } from '../CodegenSchema.js';
22
22
 
23
- export type ComponentSchemaBuilderConfig = $ReadOnly<{
23
+ export type ComponentSchemaBuilderConfig = Readonly<{
24
24
  filename: string,
25
25
  componentName: string,
26
26
  extendsProps: $ReadOnlyArray<ExtendsPropsShape>,
@@ -16,12 +16,12 @@ const path = require('path');
16
16
  export type TypeDeclarationMap = {[declarationName: string]: $FlowFixMe};
17
17
 
18
18
  export type TypeResolutionStatus =
19
- | $ReadOnly<{
19
+ | Readonly<{
20
20
  type: 'alias' | 'enum',
21
21
  successful: true,
22
22
  name: string,
23
23
  }>
24
- | $ReadOnly<{
24
+ | Readonly<{
25
25
  successful: false,
26
26
  }>;
27
27
 
@@ -66,7 +66,7 @@ function createParserErrorCapturer(): [
66
66
  function verifyPlatforms(
67
67
  hasteModuleName: string,
68
68
  moduleName: string,
69
- ): $ReadOnly<{
69
+ ): Readonly<{
70
70
  cxxOnly: boolean,
71
71
  excludedPlatforms: Array<'iOS' | 'android'>,
72
72
  }> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native/codegen",
3
- "version": "0.84.0-rc.0",
3
+ "version": "0.85.0-nightly-20260108-1236b6be4",
4
4
  "description": "Code generation tools for React Native",
5
5
  "license": "MIT",
6
6
  "repository": {