Introduce the supported member types of Union (#54591)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54591

Following types will be supported in Union currently:

1. Number : NumberType + NumberLiteralType
2. Boolean : BooleanType + BooleanLiteralType
3. String : StringType + StringLiteralType
4. Object: NativeModuleObjectType

These are the only ones that exist today as per :

https://docs.google.com/document/d/1pTBMOEIov5n5-0L9z925XPvGX1YxlmI6n6FJvd0oXtE/edit?tab=t.0#heading=h.fhe5py9plytd

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D87384995

fbshipit-source-id: 39e63fa3670343bc4063d8aa45a004671380a640
This commit is contained in:
Arushi Kesarwani authored and meta-codesync[bot] committed 2025-11-20 18:00:53 -08:00
1 parent 2d22fed85c
commit 2bbb104a4e
2 files changed
+18

No files matched your search

+9
View File
@@ -388,6 +388,15 @@ export type UnionTypeAnnotationMemberType =
| 'ObjectTypeAnnotation'
| 'StringTypeAnnotation';
export type NativeModuleUnionTypeAnnotationMemberType =
| NativeModuleObjectTypeAnnotation
| StringLiteralTypeAnnotation
| NumberLiteralTypeAnnotation
| BooleanLiteralTypeAnnotation
| BooleanTypeAnnotation
| StringTypeAnnotation
| NumberTypeAnnotation;
export interface NativeModuleUnionTypeAnnotation {
readonly type: 'UnionTypeAnnotation';
readonly memberType: UnionTypeAnnotationMemberType;
+9
View File
@@ -377,6 +377,15 @@ export type UnionTypeAnnotationMemberType =
| 'ObjectTypeAnnotation'
| 'StringTypeAnnotation';
export type NativeModuleUnionTypeAnnotationMemberType =
| NativeModuleObjectTypeAnnotation
| StringLiteralTypeAnnotation
| NumberLiteralTypeAnnotation
| BooleanLiteralTypeAnnotation
| BooleanTypeAnnotation
| StringTypeAnnotation
| NumberTypeAnnotation;
export type NativeModuleUnionTypeAnnotation = $ReadOnly<{
type: 'UnionTypeAnnotation',
memberType: UnionTypeAnnotationMemberType,