update MenuOption type so nav and onPress are mutually exclusive

This commit is contained in:
Abbey Campbell
2025-12-10 17:34:57 -08:00
parent 3fae2abd82
commit 01a8da9dbe

View File

@@ -29,16 +29,26 @@ function isDefaultMode( ) {
return useStore.getState( ).layout.isDefaultMode === true;
}
export interface MenuOption {
interface BaseMenuOption {
label: string;
navigation?: string;
icon: string;
color?: string;
onPress?: ( ) => void;
testID?: string;
isLogout?: boolean;
}
interface MenuOptionWithNavigation extends BaseMenuOption {
navigation: string;
onPress?: never;
}
interface MenuOptionWithOnPress extends BaseMenuOption {
onPress: ( ) => void;
navigation?: never;
}
export type MenuOption = MenuOptionWithNavigation | MenuOptionWithOnPress;
const feedbackLogger = log.extend( "feedback" );
function showOfflineAlert( t: ( _: string ) => string ) {