Skip to content

Commit

Permalink
fix: correct typing in create-element function (#2487)
Browse files Browse the repository at this point in the history
  • Loading branch information
odinr authored Feb 26, 2025
1 parent cefb4f4 commit bdbd574
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/four-cloths-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@equinor/fusion-react-utils': patch
---

fix typing in `create-element`
4 changes: 1 addition & 3 deletions packages/utils/src/create-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export const createComponent = <E extends HTMLElement, P extends Record<string,
displayName?: string;
} = {},
): WebComponent<E, P> => {
type ComponentProps = PropsWithoutRef<ComponentAttributes<E> & P>;
type EventProps = Partial<Record<keyof E, EventHandler<SyntheticEvent<E, Event>>>>;

const { events = {}, functions = new Set(), displayName = elementClass.name } = options;
Expand All @@ -66,9 +65,8 @@ export const createComponent = <E extends HTMLElement, P extends Record<string,
/** element native props which should be handled programmatically */
const nativePropsName = new Set([...elementPropsNames, ...Object.keys(events)]);


/** create reference component */
const component = forwardRef((props?: ComponentProps, __ref?: Ref<E>) => {
const component = forwardRef((props, __ref?: Ref<E>) => {
const ref = useForwardRef<E>(__ref);

/** bind native properties and function */
Expand Down

0 comments on commit bdbd574

Please sign in to comment.