Skip to content

Commit a6b08b0

Browse files
Refactor NativeModuleUnionTypeAnnotation (facebook#54594)
Summary: Refactoring `NativeModuleUnionTypeAnnotation` to use the newly introduced `NativeModuleUnionTypeAnnotationMemberType` Changelog: [Internal] Differential Revision: D87386775
1 parent 19cb720 commit a6b08b0

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -406,11 +406,6 @@ export interface NativeModulePromiseTypeAnnotation {
406406
readonly elementType: Nullable<NativeModuleBaseTypeAnnotation> | VoidTypeAnnotation;
407407
}
408408

409-
export type UnionTypeAnnotationMemberType =
410-
| 'NumberTypeAnnotation'
411-
| 'ObjectTypeAnnotation'
412-
| 'StringTypeAnnotation';
413-
414409
export type NativeModuleUnionTypeAnnotationMemberType =
415410
| NativeModuleObjectTypeAnnotation
416411
| StringLiteralTypeAnnotation
@@ -420,10 +415,8 @@ export type NativeModuleUnionTypeAnnotationMemberType =
420415
| StringTypeAnnotation
421416
| NumberTypeAnnotation;
422417

423-
export interface NativeModuleUnionTypeAnnotation {
424-
readonly type: 'UnionTypeAnnotation';
425-
readonly memberType: UnionTypeAnnotationMemberType;
426-
}
418+
export type NativeModuleUnionTypeAnnotation =
419+
UnionTypeAnnotation<NativeModuleUnionTypeAnnotationMemberType>;
427420

428421
export interface NativeModuleMixedTypeAnnotation {
429422
readonly type: 'MixedTypeAnnotation';

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -385,11 +385,6 @@ export type NativeModulePromiseTypeAnnotation = $ReadOnly<{
385385
elementType: VoidTypeAnnotation | Nullable<NativeModuleBaseTypeAnnotation>,
386386
}>;
387387

388-
export type UnionTypeAnnotationMemberType =
389-
| 'NumberTypeAnnotation'
390-
| 'ObjectTypeAnnotation'
391-
| 'StringTypeAnnotation';
392-
393388
export type NativeModuleUnionTypeAnnotationMemberType =
394389
| NativeModuleObjectTypeAnnotation
395390
| StringLiteralTypeAnnotation
@@ -399,10 +394,8 @@ export type NativeModuleUnionTypeAnnotationMemberType =
399394
| StringTypeAnnotation
400395
| NumberTypeAnnotation;
401396

402-
export type NativeModuleUnionTypeAnnotation = $ReadOnly<{
403-
type: 'UnionTypeAnnotation',
404-
memberType: UnionTypeAnnotationMemberType,
405-
}>;
397+
export type NativeModuleUnionTypeAnnotation =
398+
UnionTypeAnnotation<NativeModuleUnionTypeAnnotationMemberType>;
406399

407400
export type NativeModuleMixedTypeAnnotation = $ReadOnly<{
408401
type: 'MixedTypeAnnotation',

0 commit comments

Comments
 (0)