Cleanup buildMethodSchema and introduce nullable methods

Summary:
## Changes
- Started doing cleanup under `/parsers/flow/modules/methods.js`
- Rename `NativeModuleMethodTypeShape` -> `NativeModulePropertyShape`
- Moved optional property from `FunctionTypeAnnotation` to the `NativeModulePropertyShape`
- Introduced a nullable property inside what was once `FunctionTypeAnnotation`.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D23146050

fbshipit-source-id: 2fe97bb9c0736242682133e4923131a54bbea54b
This commit is contained in:
Ramanpreet Nara
2020-09-29 14:33:06 -07:00
committed by Facebook GitHub Bot
parent 747f493feb
commit f9ea52574e
5 changed files with 165 additions and 86 deletions
@@ -13,7 +13,7 @@
import type {
FunctionTypeAnnotationParam,
FunctionTypeAnnotationReturn,
NativeModuleMethodTypeShape,
NativeModulePropertyShape,
ObjectTypeAliasTypeShape,
SchemaType,
} from '../../CodegenSchema';
@@ -156,7 +156,7 @@ function translateFunctionReturnTypeToJavaType(
// Build special-cased runtime check for getConstants().
function buildGetConstantsMethod(
method: NativeModuleMethodTypeShape,
method: NativeModulePropertyShape,
imports: Set<string>,
): string {
if (