Fix flow test case input in react-native-codegen package that has syntax errors. (#26316)

Summary:
Fix flow test case input in react-native-codegen package that has syntax errors.
Missing ";" after export type,
Missing ";" or "," after interface/object type member signature,
Missing ":" in method signature,
etc

## Changelog

[General] [Fixed] - Fix flow test case input in react-native-codegen package
Pull Request resolved: https://github.com/facebook/react-native/pull/26316

Test Plan: Parsed files using flow parser, but some test cases are intended to have syntax error, in this case I fixed unexpected ones.

Reviewed By: rickhanlonii

Differential Revision: D17194969

Pulled By: osdnk

fbshipit-source-id: 262d0af4d9e7e74f7ba3eb30c4fd9753c08f3bf7
This commit is contained in:
Zihan Chen (MSFT) 2019-09-04 17:21:11 -07:00 коммит произвёл Facebook Github Bot
Родитель a31c76fbd3
Коммит d63c46de7e
3 изменённых файлов: 14 добавлений и 14 удалений

Просмотреть файл

@ -43,19 +43,19 @@ const EVENT_DEFINITION = `
object_required: { object_required: {
boolean_required: boolean, boolean_required: boolean,
} },
object_optional_key?: { object_optional_key?: {
string_optional_key?: string, string_optional_key?: string,
} },
object_optional_value: ?{ object_optional_value: ?{
float_optional_value: ?Float, float_optional_value: ?Float,
} },
object_optional_both?: ?{ object_optional_both?: ?{
int32_optional_both?: ?Int32, int32_optional_both?: ?Int32,
} },
object_required_nested_2_layers: { object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{ object_optional_nested_1_layer?: ?{
@ -65,7 +65,7 @@ const EVENT_DEFINITION = `
float_optional_value: ?Float, float_optional_value: ?Float,
int32_optional_both?: ?Int32, int32_optional_both?: ?Int32,
} }
} },
`; `;
const ONE_OF_EACH_PROP_EVENT_DEFAULT_AND_OPTIONS = ` const ONE_OF_EACH_PROP_EVENT_DEFAULT_AND_OPTIONS = `
@ -500,7 +500,7 @@ const codegenNativeComponent = require('codegenNativeComponent');
type DeepSpread = $ReadOnly<{| type DeepSpread = $ReadOnly<{|
otherStringProp: string, otherStringProp: string,
|}> |}>;
export type PropsInFile = $ReadOnly<{| export type PropsInFile = $ReadOnly<{|
...DeepSpread, ...DeepSpread,
@ -511,11 +511,11 @@ export type PropsInFile = $ReadOnly<{|
export type ModuleProps = $ReadOnly<{| export type ModuleProps = $ReadOnly<{|
...ViewProps, ...ViewProps,
...PropsInFile ...PropsInFile,
localType: $ReadOnly<{| localType: $ReadOnly<{|
...PropsInFile ...PropsInFile
|}> |}>,
localArr: $ReadOnlyArray<PropsInFile> localArr: $ReadOnlyArray<PropsInFile>
|}>; |}>;
@ -898,7 +898,7 @@ export type ModuleProps = $ReadOnly<{|
type NativeType = NativeComponent<ModuleProps>; type NativeType = NativeComponent<ModuleProps>;
export type ScrollTo = (viewRef: React.ElementRef<NativeType>, y: Int, animated: Boolean) => Void export type ScrollTo = (viewRef: React.ElementRef<NativeType>, y: Int, animated: Boolean) => Void;
interface NativeCommands { interface NativeCommands {
+scrollTo: ScrollTo; +scrollTo: ScrollTo;

Просмотреть файл

@ -199,11 +199,11 @@ import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry'; import * as TurboModuleRegistry from '../TurboModuleRegistry';
export interface Spec extends TurboModule { export interface Spec extends TurboModule {
+getSth(a : ?number) => void +getSth: (a : ?number) => void
} }
export interface Spec2 extends TurboModule { export interface Spec2 extends TurboModule {
+getSth(a : ?number) => void +getSth: (a : ?number) => void
} }

Просмотреть файл

@ -50,7 +50,7 @@ const NATIVE_MODULE_WITH_COMPLEX_OBJECTS = `
import type {TurboModule} from '../RCTExport'; import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry'; import * as TurboModuleRegistry from '../TurboModuleRegistry';
export type String = string export type String = string;
export interface Spec extends TurboModule { export interface Spec extends TurboModule {
// Exported methods. // Exported methods.
@ -208,7 +208,7 @@ import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry'; import * as TurboModuleRegistry from '../TurboModuleRegistry';
export interface Spec extends TurboModule { export interface Spec extends TurboModule {
+getObject(o : Object) => Object, +getObject: (o : Object) => Object,
} }
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule'); export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
@ -390,7 +390,7 @@ const NATIVE_MODULE_WITH_PROMISE = `/**
import type {TurboModule} from '../RCTExport'; import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry'; import * as TurboModuleRegistry from '../TurboModuleRegistry';
export type String = string export type String = string;
export type SomeObj = {| a: string |}; export type SomeObj = {| a: string |};
export interface Spec extends TurboModule { export interface Spec extends TurboModule {