Remove miscellaneous exports of NativeModule Flow types in Codegen Schema

Summary:
CodegenSchema exports `NativeModuleMethodParamSchema` and `NativeModuleObjectTypeAnnotationPropertySchema`, which are partials of NativeModule type annotations. This creates unnecessary coupling between the type annotations of CodegenSchema and the files that depend on it.

**Actual Problem:** Suppose that we want to rename one of these partials. Then, all imports in all files would have to be updated, even when the actual shape of the composed type annotation wasn't changed.

This diff removes these partials, which reduces the surface area of the exports of CodegenSchema.js

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D24719396

fbshipit-source-id: c822aaa252f156c524f4ef4917ebb61b1a39ff9e
This commit is contained in:
Ramanpreet Nara
2020-11-05 18:30:08 -08:00
committed by Facebook GitHub Bot
parent 04f235e7fb
commit c6b8c75b6b
6 changed files with 86 additions and 84 deletions
@@ -13,7 +13,8 @@
import type {
SchemaType,
NativeModulePropertySchema,
NativeModuleMethodParamSchema,
Nullable,
NamedShape,
NativeModuleFunctionTypeAnnotation,
NativeModuleParamTypeAnnotation,
} from '../../CodegenSchema';
@@ -99,8 +100,10 @@ ${modules}
`;
};
type Param = NamedShape<Nullable<NativeModuleParamTypeAnnotation>>;
function serializeArg(
arg: NativeModuleMethodParamSchema,
arg: Param,
index: number,
resolveAlias: AliasResolver,
): string {