Remove pipes from Object literal Flow types

Summary:
## Changes
{| ... |} -> { ... }

**Motivation:** In Flow, object literals are exact by default. So, there's no need for the pipes. Also: Now, the syntax for object literals is consistent across react-native-codegen.

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D24774771

fbshipit-source-id: 24ceb6f5876122aa8ad9e08c7e903215864ad6f5
This commit is contained in:
Ramanpreet Nara
2020-11-06 16:24:44 -08:00
committed by Facebook GitHub Bot
parent cb7f3f4499
commit 00cfb0f919
21 changed files with 195 additions and 199 deletions
@@ -20,11 +20,11 @@ const ModuleTemplate = ({
hasteModuleName,
structs,
methodSerializationOutputs,
}: $ReadOnly<{|
}: $ReadOnly<{
hasteModuleName: string,
structs: $ReadOnlyArray<Struct>,
methodSerializationOutputs: $ReadOnlyArray<MethodSerializationOutput>,
|}>) => `${structs
}>) => `${structs
.map(struct =>
RCTCxxConvertCategoryTemplate({hasteModuleName, structName: struct.name}),
)
@@ -61,10 +61,10 @@ namespace facebook {
const RCTCxxConvertCategoryTemplate = ({
hasteModuleName,
structName,
}: $ReadOnly<{|
}: $ReadOnly<{
hasteModuleName: string,
structName: string,
|}>) => `@implementation RCTCxxConvert (${hasteModuleName}_${structName})
}>) => `@implementation RCTCxxConvert (${hasteModuleName}_${structName})
+ (RCTManagedPointer *)JS_${hasteModuleName}_${structName}:(id)json
{
return facebook::react::managedPointer<JS::${hasteModuleName}::${structName}>(json);
@@ -76,12 +76,12 @@ const InlineHostFunctionTemplate = ({
methodName,
returnJSType,
selector,
}: $ReadOnly<{|
}: $ReadOnly<{
hasteModuleName: string,
methodName: string,
returnJSType: string,
selector: string,
|}>) => `
}>) => `
static facebook::jsi::Value __hostFunction_${hasteModuleName}SpecJSI_${methodName}(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, ${returnJSType}, "${methodName}", ${selector}, args, count);
}`;
@@ -91,12 +91,12 @@ const MethodMapEntryTemplate = ({
methodName,
structParamRecords,
argCount,
}: $ReadOnly<{|
}: $ReadOnly<{
hasteModuleName: string,
methodName: string,
structParamRecords: $ReadOnlyArray<StructParameterRecord>,
argCount: number,
|}>) => `
}>) => `
methodMap_["${methodName}"] = MethodMetadata {${argCount}, __hostFunction_${hasteModuleName}SpecJSI_${methodName}};
${structParamRecords
.map(({paramIndex, structName}) => {