diff --git a/packages/react-native-codegen/src/CodegenSchema.d.ts b/packages/react-native-codegen/src/CodegenSchema.d.ts index 9d121f6a75cb9c..889dce86f57f70 100644 --- a/packages/react-native-codegen/src/CodegenSchema.d.ts +++ b/packages/react-native-codegen/src/CodegenSchema.d.ts @@ -142,6 +142,14 @@ export type ComponentArrayTypeAnnotation = ArrayTypeAnnotation< | ArrayTypeAnnotation> >; +export type ComponentCommandArrayTypeAnnotation = ArrayTypeAnnotation< + | BooleanTypeAnnotation + | StringTypeAnnotation + | DoubleTypeAnnotation + | FloatTypeAnnotation + | Int32TypeAnnotation +>; + export interface ArrayTypeAnnotation { readonly type: 'ArrayTypeAnnotation'; readonly elementType: T; @@ -206,7 +214,7 @@ export type CommandParamTypeAnnotation = | DoubleTypeAnnotation | FloatTypeAnnotation | StringTypeAnnotation - | ComponentArrayTypeAnnotation; + | ComponentCommandArrayTypeAnnotation; export interface ReservedTypeAnnotation { readonly type: 'ReservedTypeAnnotation'; diff --git a/packages/react-native-codegen/src/CodegenSchema.js b/packages/react-native-codegen/src/CodegenSchema.js index 14552f63f063be..f76b1d03d4034d 100644 --- a/packages/react-native-codegen/src/CodegenSchema.js +++ b/packages/react-native-codegen/src/CodegenSchema.js @@ -158,6 +158,14 @@ export type ComponentArrayTypeAnnotation = ArrayTypeAnnotation< | ArrayTypeAnnotation>, >; +export type ComponentCommandArrayTypeAnnotation = ArrayTypeAnnotation< + | BooleanTypeAnnotation + | StringTypeAnnotation + | DoubleTypeAnnotation + | FloatTypeAnnotation + | Int32TypeAnnotation, +>; + export type ArrayTypeAnnotation<+T> = $ReadOnly<{ type: 'ArrayTypeAnnotation', elementType: T, @@ -222,7 +230,7 @@ export type CommandParamTypeAnnotation = | DoubleTypeAnnotation | FloatTypeAnnotation | StringTypeAnnotation - | ComponentArrayTypeAnnotation; + | ComponentCommandArrayTypeAnnotation; export type ReservedTypeAnnotation = $ReadOnly<{ type: 'ReservedTypeAnnotation', @@ -412,6 +420,14 @@ type NativeModuleReturnOnlyTypeAnnotation = | NativeModulePromiseTypeAnnotation | VoidTypeAnnotation; +// Add the allowed component reserved types to the native module union +export type CompleteReservedTypeAnnotation = + | ReservedTypeAnnotation + | { + type: 'ReservedTypeAnnotation', + name: ReservedPropTypeAnnotation['name'], + }; + // Used by compatibility check which needs to handle all possible types // This will eventually also include the union of all view manager types export type CompleteTypeAnnotation = @@ -421,7 +437,6 @@ export type CompleteTypeAnnotation = | EventEmitterTypeAnnotation | NativeModuleEnumDeclarationWithMembers | UnsafeAnyTypeAnnotation - // Native Module event emitters and methods - | ObjectTypeAnnotation< - Nullable | EventEmitterTypeAnnotation, - >; + | ArrayTypeAnnotation + | ObjectTypeAnnotation + | CompleteReservedTypeAnnotation;