Skip to content

Commit 41efc3b

Browse files
marcoww6meta-codesync[bot]
authored andcommitted
Transform $ReadOnly to Readonly 38/n (#55067)
Summary: Pull Request resolved: #55067 Differential Revision: D90146229 fbshipit-source-id: 62733ba51fd0c318140b7a76b499b1a7ac1f7853
1 parent 1cc30dc commit 41efc3b

File tree

156 files changed

+344
-344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+344
-344
lines changed

packages/react-native-codegen/src/CodegenSchema.js

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -12,111 +12,111 @@
1212

1313
export type PlatformType = 'iOS' | 'android';
1414

15-
export type SchemaType = $ReadOnly<{
15+
export type SchemaType = Readonly<{
1616
libraryName?: string,
17-
modules: $ReadOnly<{
17+
modules: Readonly<{
1818
[hasteModuleName: string]: ComponentSchema | NativeModuleSchema,
1919
}>,
2020
}>;
2121

2222
/**
2323
* Component Type Annotations
2424
*/
25-
export type DoubleTypeAnnotation = $ReadOnly<{
25+
export type DoubleTypeAnnotation = Readonly<{
2626
type: 'DoubleTypeAnnotation',
2727
}>;
2828

29-
export type FloatTypeAnnotation = $ReadOnly<{
29+
export type FloatTypeAnnotation = Readonly<{
3030
type: 'FloatTypeAnnotation',
3131
}>;
3232

33-
export type NumberTypeAnnotation = $ReadOnly<{
33+
export type NumberTypeAnnotation = Readonly<{
3434
type: 'NumberTypeAnnotation',
3535
}>;
3636

37-
export type BooleanTypeAnnotation = $ReadOnly<{
37+
export type BooleanTypeAnnotation = Readonly<{
3838
type: 'BooleanTypeAnnotation',
3939
}>;
4040

41-
export type Int32TypeAnnotation = $ReadOnly<{
41+
export type Int32TypeAnnotation = Readonly<{
4242
type: 'Int32TypeAnnotation',
4343
}>;
4444

45-
export type NumberLiteralTypeAnnotation = $ReadOnly<{
45+
export type NumberLiteralTypeAnnotation = Readonly<{
4646
type: 'NumberLiteralTypeAnnotation',
4747
value: number,
4848
}>;
4949

50-
export type StringTypeAnnotation = $ReadOnly<{
50+
export type StringTypeAnnotation = Readonly<{
5151
type: 'StringTypeAnnotation',
5252
}>;
5353

54-
export type StringLiteralTypeAnnotation = $ReadOnly<{
54+
export type StringLiteralTypeAnnotation = Readonly<{
5555
type: 'StringLiteralTypeAnnotation',
5656
value: string,
5757
}>;
5858

59-
export type BooleanLiteralTypeAnnotation = $ReadOnly<{
59+
export type BooleanLiteralTypeAnnotation = Readonly<{
6060
type: 'BooleanLiteralTypeAnnotation',
6161
value: boolean,
6262
}>;
6363

6464
export type StringLiteralUnionTypeAnnotation =
6565
UnionTypeAnnotation<StringLiteralTypeAnnotation>;
6666

67-
export type VoidTypeAnnotation = $ReadOnly<{
67+
export type VoidTypeAnnotation = Readonly<{
6868
type: 'VoidTypeAnnotation',
6969
}>;
7070

71-
export type ObjectTypeAnnotation<+T> = $ReadOnly<{
71+
export type ObjectTypeAnnotation<+T> = Readonly<{
7272
type: 'ObjectTypeAnnotation',
7373
properties: $ReadOnlyArray<NamedShape<T>>,
7474
// metadata for objects that generated from interfaces
7575
baseTypes?: $ReadOnlyArray<string>,
7676
}>;
7777

78-
export type UnionTypeAnnotation<+T> = $ReadOnly<{
78+
export type UnionTypeAnnotation<+T> = Readonly<{
7979
type: 'UnionTypeAnnotation',
8080
types: $ReadOnlyArray<T>,
8181
}>;
8282

83-
export type MixedTypeAnnotation = $ReadOnly<{
83+
export type MixedTypeAnnotation = Readonly<{
8484
type: 'MixedTypeAnnotation',
8585
}>;
8686

87-
export type EventEmitterTypeAnnotation = $ReadOnly<{
87+
export type EventEmitterTypeAnnotation = Readonly<{
8888
type: 'EventEmitterTypeAnnotation',
8989
typeAnnotation: NativeModuleEventEmitterTypeAnnotation | $FlowFixMe,
9090
}>;
9191

92-
type FunctionTypeAnnotation<+P, +R> = $ReadOnly<{
92+
type FunctionTypeAnnotation<+P, +R> = Readonly<{
9393
type: 'FunctionTypeAnnotation',
9494
params: $ReadOnlyArray<NamedShape<P>>,
9595
returnTypeAnnotation: R,
9696
}>;
9797

98-
export type NamedShape<+T> = $ReadOnly<{
98+
export type NamedShape<+T> = Readonly<{
9999
name: string,
100100
optional: boolean,
101101
typeAnnotation: T,
102102
}>;
103103

104-
export type ComponentSchema = $ReadOnly<{
104+
export type ComponentSchema = Readonly<{
105105
type: 'Component',
106-
components: $ReadOnly<{
106+
components: Readonly<{
107107
[componentName: string]: ComponentShape,
108108
}>,
109109
}>;
110110

111-
export type ComponentShape = $ReadOnly<{
111+
export type ComponentShape = Readonly<{
112112
...OptionsShape,
113113
extendsProps: $ReadOnlyArray<ExtendsPropsShape>,
114114
events: $ReadOnlyArray<EventTypeShape>,
115115
props: $ReadOnlyArray<NamedShape<PropTypeAnnotation>>,
116116
commands: $ReadOnlyArray<NamedShape<CommandTypeAnnotation>>,
117117
}>;
118118

119-
export type OptionsShape = $ReadOnly<{
119+
export type OptionsShape = Readonly<{
120120
// Use to generate only interfaces of components (C++ Props, C++ EventEmitters, JVM interfaces) and not their implementation.
121121
// This is useful for components that have a custom implementation of ShadowNode, ComponentDescriptor, State.
122122
interfaceOnly?: boolean,
@@ -134,17 +134,17 @@ export type OptionsShape = $ReadOnly<{
134134
generateOptionalObjectProperties?: boolean,
135135
}>;
136136

137-
export type ExtendsPropsShape = $ReadOnly<{
137+
export type ExtendsPropsShape = Readonly<{
138138
type: 'ReactNativeBuiltInType',
139139
knownTypeName: 'ReactNativeCoreViewProps',
140140
}>;
141141

142-
export type EventTypeShape = $ReadOnly<{
142+
export type EventTypeShape = Readonly<{
143143
name: string,
144144
bubblingType: 'direct' | 'bubble',
145145
optional: boolean,
146146
paperTopLevelNameDeprecated?: string,
147-
typeAnnotation: $ReadOnly<{
147+
typeAnnotation: Readonly<{
148148
type: 'EventTypeAnnotation',
149149
argument?: ObjectTypeAnnotation<EventTypeAnnotation>,
150150
}>,
@@ -168,7 +168,7 @@ export type ComponentArrayTypeAnnotation = ArrayTypeAnnotation<
168168
| FloatTypeAnnotation
169169
| Int32TypeAnnotation
170170
| MixedTypeAnnotation
171-
| $ReadOnly<{
171+
| Readonly<{
172172
type: 'StringEnumTypeAnnotation',
173173
default: string,
174174
options: $ReadOnlyArray<string>,
@@ -191,38 +191,38 @@ export type ComponentCommandArrayTypeAnnotation = ArrayTypeAnnotation<
191191
| MixedTypeAnnotation,
192192
>;
193193

194-
export type ArrayTypeAnnotation<+T> = $ReadOnly<{
194+
export type ArrayTypeAnnotation<+T> = Readonly<{
195195
type: 'ArrayTypeAnnotation',
196196
elementType: T,
197197
}>;
198198

199199
export type PropTypeAnnotation =
200-
| $ReadOnly<{
200+
| Readonly<{
201201
type: 'BooleanTypeAnnotation',
202202
default: boolean | null,
203203
}>
204-
| $ReadOnly<{
204+
| Readonly<{
205205
type: 'StringTypeAnnotation',
206206
default: string | null,
207207
}>
208-
| $ReadOnly<{
208+
| Readonly<{
209209
type: 'DoubleTypeAnnotation',
210210
default: number,
211211
}>
212-
| $ReadOnly<{
212+
| Readonly<{
213213
type: 'FloatTypeAnnotation',
214214
default: number | null,
215215
}>
216-
| $ReadOnly<{
216+
| Readonly<{
217217
type: 'Int32TypeAnnotation',
218218
default: number,
219219
}>
220-
| $ReadOnly<{
220+
| Readonly<{
221221
type: 'StringEnumTypeAnnotation',
222222
default: string,
223223
options: $ReadOnlyArray<string>,
224224
}>
225-
| $ReadOnly<{
225+
| Readonly<{
226226
type: 'Int32EnumTypeAnnotation',
227227
default: number,
228228
options: $ReadOnlyArray<number>,
@@ -232,7 +232,7 @@ export type PropTypeAnnotation =
232232
| ComponentArrayTypeAnnotation
233233
| MixedTypeAnnotation;
234234

235-
export type ReservedPropTypeAnnotation = $ReadOnly<{
235+
export type ReservedPropTypeAnnotation = Readonly<{
236236
type: 'ReservedPropTypeAnnotation',
237237
name:
238238
| 'ColorPrimitive'
@@ -257,7 +257,7 @@ export type CommandParamTypeAnnotation =
257257
| StringTypeAnnotation
258258
| ComponentCommandArrayTypeAnnotation;
259259

260-
export type ReservedTypeAnnotation = $ReadOnly<{
260+
export type ReservedTypeAnnotation = Readonly<{
261261
type: 'ReservedTypeAnnotation',
262262
name: 'RootTag', // Union with more custom types.
263263
}>;
@@ -269,12 +269,12 @@ export type Nullable<+T: NativeModuleTypeAnnotation> =
269269
| NullableTypeAnnotation<T>
270270
| T;
271271

272-
export type NullableTypeAnnotation<+T: NativeModuleTypeAnnotation> = $ReadOnly<{
272+
export type NullableTypeAnnotation<+T: NativeModuleTypeAnnotation> = Readonly<{
273273
type: 'NullableTypeAnnotation',
274274
typeAnnotation: T,
275275
}>;
276276

277-
export type NativeModuleSchema = $ReadOnly<{
277+
export type NativeModuleSchema = Readonly<{
278278
type: 'NativeModule',
279279
aliasMap: NativeModuleAliasMap,
280280
enumMap: NativeModuleEnumMap,
@@ -286,7 +286,7 @@ export type NativeModuleSchema = $ReadOnly<{
286286
excludedPlatforms?: $ReadOnlyArray<PlatformType>,
287287
}>;
288288

289-
type NativeModuleSpec = $ReadOnly<{
289+
type NativeModuleSpec = Readonly<{
290290
eventEmitters: $ReadOnlyArray<NativeModuleEventEmitterShape>,
291291
methods: $ReadOnlyArray<NativeModulePropertyShape>,
292292
}>;
@@ -298,11 +298,11 @@ export type NativeModulePropertyShape = NamedShape<
298298
Nullable<NativeModuleFunctionTypeAnnotation>,
299299
>;
300300

301-
export type NativeModuleEnumMap = $ReadOnly<{
301+
export type NativeModuleEnumMap = Readonly<{
302302
[enumName: string]: NativeModuleEnumDeclarationWithMembers,
303303
}>;
304304

305-
export type NativeModuleAliasMap = $ReadOnly<{
305+
export type NativeModuleAliasMap = Readonly<{
306306
[aliasName: string]: NativeModuleObjectTypeAnnotation,
307307
}>;
308308

@@ -330,7 +330,7 @@ export type UnsafeAnyTypeAnnotation = {
330330
type: 'AnyTypeAnnotation',
331331
};
332332

333-
export type NativeModuleNumberTypeAnnotation = $ReadOnly<{
333+
export type NativeModuleNumberTypeAnnotation = Readonly<{
334334
type: 'NumberTypeAnnotation',
335335
}>;
336336

@@ -343,7 +343,7 @@ export type NativeModuleEnumMemberType =
343343
| 'NumberTypeAnnotation'
344344
| 'StringTypeAnnotation';
345345

346-
export type NativeModuleEnumDeclaration = $ReadOnly<{
346+
export type NativeModuleEnumDeclaration = Readonly<{
347347
name: string,
348348
type: 'EnumDeclaration',
349349
memberType: NativeModuleEnumMemberType,
@@ -356,20 +356,20 @@ export type NativeModuleEnumDeclarationWithMembers = {
356356
members: $ReadOnlyArray<NativeModuleEnumMember>,
357357
};
358358

359-
export type NativeModuleGenericObjectTypeAnnotation = $ReadOnly<{
359+
export type NativeModuleGenericObjectTypeAnnotation = Readonly<{
360360
type: 'GenericObjectTypeAnnotation',
361361
// a dictionary type is codegen as "Object"
362362
// but we know all its members are in the same type
363363
// when it happens, the following field is non-null
364364
dictionaryValueType?: Nullable<NativeModuleTypeAnnotation>,
365365
}>;
366366

367-
export type NativeModuleTypeAliasTypeAnnotation = $ReadOnly<{
367+
export type NativeModuleTypeAliasTypeAnnotation = Readonly<{
368368
type: 'TypeAliasTypeAnnotation',
369369
name: string,
370370
}>;
371371

372-
export type NativeModulePromiseTypeAnnotation = $ReadOnly<{
372+
export type NativeModulePromiseTypeAnnotation = Readonly<{
373373
type: 'PromiseTypeAnnotation',
374374
elementType: VoidTypeAnnotation | Nullable<NativeModuleBaseTypeAnnotation>,
375375
}>;
@@ -386,7 +386,7 @@ export type NativeModuleUnionTypeAnnotationMemberType =
386386
export type NativeModuleUnionTypeAnnotation =
387387
UnionTypeAnnotation<NativeModuleUnionTypeAnnotationMemberType>;
388388

389-
export type NativeModuleMixedTypeAnnotation = $ReadOnly<{
389+
export type NativeModuleMixedTypeAnnotation = Readonly<{
390390
type: 'MixedTypeAnnotation',
391391
}>;
392392

packages/react-native-codegen/src/generators/RNCodegen.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ export type GenerateFunction = (
8282
includeGetDebugPropsImplementation?: boolean,
8383
) => FilesOutput;
8484

85-
export type LibraryGeneratorsFunctions = $ReadOnly<{
85+
export type LibraryGeneratorsFunctions = Readonly<{
8686
[string]: Array<GenerateFunction>,
8787
}>;
8888

89-
export type LibraryOptions = $ReadOnly<{
89+
export type LibraryOptions = Readonly<{
9090
libraryName: string,
9191
schema: SchemaType,
9292
outputDirectory: string,
@@ -97,7 +97,7 @@ export type LibraryOptions = $ReadOnly<{
9797
libraryGenerators?: LibraryGeneratorsFunctions,
9898
}>;
9999

100-
export type SchemasOptions = $ReadOnly<{
100+
export type SchemasOptions = Readonly<{
101101
schemas: {[string]: SchemaType},
102102
outputDirectory: string,
103103
supportedApplePlatforms?: {[string]: {[string]: boolean}},
@@ -118,12 +118,12 @@ export type LibraryGenerators =
118118

119119
export type SchemasGenerators = 'providerIOS';
120120

121-
export type LibraryConfig = $ReadOnly<{
121+
export type LibraryConfig = Readonly<{
122122
generators: Array<LibraryGenerators>,
123123
test?: boolean,
124124
}>;
125125

126-
export type SchemasConfig = $ReadOnly<{
126+
export type SchemasConfig = Readonly<{
127127
generators: Array<SchemasGenerators>,
128128
test?: boolean,
129129
}>;

packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const {IncludeTemplate, generateEventStructName} = require('./CppHelpers');
2525
// File path -> contents
2626
type FilesOutput = Map<string, string>;
2727

28-
type ComponentCollection = $ReadOnly<{
28+
type ComponentCollection = Readonly<{
2929
[component: string]: ComponentShape,
3030
...
3131
}>;

packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const nullthrows = require('nullthrows');
3131
type FilesOutput = Map<string, string>;
3232
type StructsMap = Map<string, string>;
3333

34-
type ComponentCollection = $ReadOnly<{
34+
type ComponentCollection = Readonly<{
3535
[component: string]: ComponentShape,
3636
...
3737
}>;

0 commit comments

Comments
 (0)