Files
twenty/packages/twenty-front/src/utils/createEventContext.ts
T
2025-08-10 23:25:58 +02:00

13 lines
382 B
TypeScript

import { type Context, createContext } from 'react';
type ObjectOfFunctions = {
[key: string]: (...args: any[]) => void;
};
export type EventContext<T extends ObjectOfFunctions> =
T extends ObjectOfFunctions ? T : never;
export const createEventContext = <T extends ObjectOfFunctions>(): Context<
EventContext<T>
> => createContext<EventContext<T>>({} as EventContext<T>);