@ffsm/compositor
Version:
A collection of declarative React utility components for simplified component composition, conditional rendering, and prop management - making React UI development more maintainable and expressive.
21 lines (20 loc) • 812 B
TypeScript
/**
* Creates a new Compositor event with specified name and value.
*
* @template Ev - The type to cast the returned event to
* @param {string | undefined} name - The name of the event, can be undefined
* @param {unknown} value - The value associated with the event
* @returns {Ev} A new CompositorEvent instance cast to the specified type Ev
*
* @example
* // Create a simple event
* const clickEvent = createEvent<ClickEvent>('click', { x: 100, y: 200 });
*
* @example
* // Create an event with a specific type
* interface FormSubmitEvent extends CompositorEvent {
* formData: Record<string, unknown>;
* }
* const submitEvent = createEvent<FormSubmitEvent>('submit', { formData: { name: 'John' } });
*/
export declare function createEvent<Ev>(name: string | undefined, value: unknown): Ev;