export type ActionGate> = ( key: keyof T, defaultValue?: boolean, ) => boolean; export function createAccountActionGate>(params: { baseActions?: T; accountActions?: T; }): ActionGate { return (key, defaultValue = true) => { const accountValue = params.accountActions?.[key]; if (accountValue !== undefined) { return accountValue; } const baseValue = params.baseActions?.[key]; if (baseValue !== undefined) { return baseValue; } return defaultValue; }; }