Skip to content

Commit

Permalink
Fix flow test case input in react-native-codegen package that has syn…
Browse files Browse the repository at this point in the history
…tax 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: #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
  • Loading branch information
ZihanChen-MSFT authored and facebook-github-bot committed Sep 5, 2019
1 parent a31c76f commit d63c46d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ const EVENT_DEFINITION = `
object_required: {
boolean_required: boolean,
}
},
object_optional_key?: {
string_optional_key?: string,
}
},
object_optional_value: ?{
float_optional_value: ?Float,
}
},
object_optional_both?: ?{
int32_optional_both?: ?Int32,
}
},
object_required_nested_2_layers: {
object_optional_nested_1_layer?: ?{
Expand All @@ -65,7 +65,7 @@ const EVENT_DEFINITION = `
float_optional_value: ?Float,
int32_optional_both?: ?Int32,
}
}
},
`;

const ONE_OF_EACH_PROP_EVENT_DEFAULT_AND_OPTIONS = `
Expand Down Expand Up @@ -500,7 +500,7 @@ const codegenNativeComponent = require('codegenNativeComponent');
type DeepSpread = $ReadOnly<{|
otherStringProp: string,
|}>
|}>;
export type PropsInFile = $ReadOnly<{|
...DeepSpread,
Expand All @@ -511,11 +511,11 @@ export type PropsInFile = $ReadOnly<{|
export type ModuleProps = $ReadOnly<{|
...ViewProps,
...PropsInFile
...PropsInFile,
localType: $ReadOnly<{|
...PropsInFile
|}>
|}>,
localArr: $ReadOnlyArray<PropsInFile>
|}>;
Expand Down Expand Up @@ -898,7 +898,7 @@ export type ModuleProps = $ReadOnly<{|
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 {
+scrollTo: ScrollTo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
export interface Spec extends TurboModule {
+getSth(a : ?number) => void
+getSth: (a : ?number) => void
}
export interface Spec2 extends TurboModule {
+getSth(a : ?number) => void
+getSth: (a : ?number) => void
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const NATIVE_MODULE_WITH_COMPLEX_OBJECTS = `
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
export type String = string
export type String = string;
export interface Spec extends TurboModule {
// Exported methods.
Expand Down Expand Up @@ -208,7 +208,7 @@ import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
export interface Spec extends TurboModule {
+getObject(o : Object) => Object,
+getObject: (o : Object) => Object,
}
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
Expand Down Expand Up @@ -390,7 +390,7 @@ const NATIVE_MODULE_WITH_PROMISE = `/**
import type {TurboModule} from '../RCTExport';
import * as TurboModuleRegistry from '../TurboModuleRegistry';
export type String = string
export type String = string;
export type SomeObj = {| a: string |};
export interface Spec extends TurboModule {
Expand Down

0 comments on commit d63c46d

Please sign in to comment.