Refactor: Make NativeModuleArrayTypeAnnotation elementType customizable

Summary:
In the future, we'll use `NativeModuleArrayTypeAnnotation` inside JS struct objects. Structs cannot contain `ObjectTypeAnnotations` anywhere. Therefore, we need the elementType of `NativeModuuleArrayTypeAnnotation`'s elementType customizable.

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D23645210

fbshipit-source-id: 97abb993d59536ebd68ec08b18ce7f2801c68a2d
This commit is contained in:
Ramanpreet Nara
2020-09-29 14:39:39 -07:00
committed by Facebook GitHub Bot
parent 4927de6011
commit 91a7da087b
+5 -3
View File
@@ -306,13 +306,15 @@ export type NativeModuleObjectTypeAnnotation = $ReadOnly<{|
nullable: boolean,
|}>;
export type NativeModuleArrayTypeAnnotation = $ReadOnly<{|
export type NativeModuleArrayTypeAnnotation<
T = NativeModuleBaseTypeAnnotation,
> = $ReadOnly<{|
type: 'ArrayTypeAnnotation',
/**
* TODO(T72031674): Migrate all our NativeModule specs to not use
* invalid Array ElementTypes. Then, make the elementType required.
*/
elementType?: NativeModuleBaseTypeAnnotation,
elementType?: T,
nullable: boolean,
|}>;
@@ -383,7 +385,7 @@ export type NativeModuleBaseTypeAnnotation =
| NativeModuleGenericObjectTypeAnnotation
| NativeModuleReservedFunctionValueTypeAnnotation
| NativeModuleTypeAliasTypeAnnotation
| NativeModuleArrayTypeAnnotation
| NativeModuleArrayTypeAnnotation<>
| NativeModuleObjectTypeAnnotation;
export type NativeModuleParamTypeAnnotation =