Files
twenty/packages/twenty-front/src/utils/createEventContext.ts
Aditya Pimpalkar 4a67cfa1c3 feat: Revamp navigation bar (#6031)
closes: #4428

Testing for fetchMoreRecords is pending, along with component tests

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-07-16 14:38:17 +02:00

13 lines
377 B
TypeScript

import { 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>);