From b99c69a1949308e4232d35289242f75f594aa4a1 Mon Sep 17 00:00:00 2001 From: Arushi Kesarwani Date: Wed, 19 Nov 2025 22:30:28 -0800 Subject: [PATCH] Introduce generic UnionTypeAnnotation (#54587) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54587 Adding the generic type T UnionTypeAnnotation. This will be used later to create Unions of types String, Number & Boolean. Changelog: [Internal] Reviewed By: elicwhite Differential Revision: D87374445 fbshipit-source-id: 7844f969111af14e42d2b57891e4c0935a0dce53 --- packages/react-native-codegen/src/CodegenSchema.d.ts | 5 +++++ packages/react-native-codegen/src/CodegenSchema.js | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/packages/react-native-codegen/src/CodegenSchema.d.ts b/packages/react-native-codegen/src/CodegenSchema.d.ts index 4f1ad89b87e..fc68a172244 100644 --- a/packages/react-native-codegen/src/CodegenSchema.d.ts +++ b/packages/react-native-codegen/src/CodegenSchema.d.ts @@ -53,6 +53,11 @@ export interface ObjectTypeAnnotation { readonly baseTypes?: readonly string[] | undefined; } +export interface UnionTypeAnnotation { + readonly type: 'UnionTypeAnnotation'; + readonly types: readonly T[]; +} + export interface MixedTypeAnnotation { readonly type: 'MixedTypeAnnotation'; } diff --git a/packages/react-native-codegen/src/CodegenSchema.js b/packages/react-native-codegen/src/CodegenSchema.js index c5e154c5b7d..98cf7af9396 100644 --- a/packages/react-native-codegen/src/CodegenSchema.js +++ b/packages/react-native-codegen/src/CodegenSchema.js @@ -72,6 +72,11 @@ export type ObjectTypeAnnotation<+T> = $ReadOnly<{ baseTypes?: $ReadOnlyArray, }>; +export type UnionTypeAnnotation<+T> = $ReadOnly<{ + type: 'UnionTypeAnnotation', + types: $ReadOnlyArray, +}>; + export type MixedTypeAnnotation = $ReadOnly<{ type: 'MixedTypeAnnotation', }>;