Skip to content

Commit fe33882

Browse files
Introduce generic UnionTypeAnnotation (#54587)
Summary: Adding the generic type T UnionTypeAnnotation. This will be used later to create Unions of types String, Number & Boolean. Changelog: [Internal] Differential Revision: D87374445
1 parent b373286 commit fe33882

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/react-native-codegen/src/CodegenSchema.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ export interface ObjectTypeAnnotation<T> {
5353
readonly baseTypes?: readonly string[] | undefined;
5454
}
5555

56+
export interface UnionTypeAnnotation<T> {
57+
readonly type: 'UnionTypeAnnotation';
58+
readonly types: readonly T[];
59+
}
60+
5661
export interface MixedTypeAnnotation {
5762
readonly type: 'MixedTypeAnnotation';
5863
}

packages/react-native-codegen/src/CodegenSchema.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ export type ObjectTypeAnnotation<+T> = $ReadOnly<{
7272
baseTypes?: $ReadOnlyArray<string>,
7373
}>;
7474

75+
export type UnionTypeAnnotation<+T> = $ReadOnly<{
76+
type: 'UnionTypeAnnotation',
77+
types: $ReadOnlyArray<T>,
78+
}>;
79+
7580
export type MixedTypeAnnotation = $ReadOnly<{
7681
type: 'MixedTypeAnnotation',
7782
}>;

0 commit comments

Comments
 (0)