Skip to content

Commit a7850ad

Browse files
committed
fix(utils): 🏷️ change type fixing prop inference issue in components
1 parent 910dd7e commit a7850ad

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/utils/createComponent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as React from "react";
44
import { createElement } from "./createElement";
55

66
export function createComponent<Props extends {}>(
7-
componentType: React.ElementType,
7+
componentType: React.ComponentType<Props>,
88
options?: { shouldMemo?: boolean },
99
):
1010
| React.ForwardRefExoticComponent<Props & React.RefAttributes<unknown>>

src/utils/createElement.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import React from "react";
22

33
interface CreateElementProps<Props extends {}> {
4-
componentType: React.ElementType;
4+
componentType: React.ComponentType<Props>;
55
props: Props;
66
}
77

88
export function createElement<Props extends {}>({
99
componentType,
1010
props,
11-
}: CreateElementProps<Props>): React.ReactElement<
12-
Props,
13-
string | React.JSXElementConstructor<unknown>
14-
> {
11+
}: CreateElementProps<Props>): React.ReactElement<Props> {
1512
return React.createElement(componentType, props);
1613
}

0 commit comments

Comments
 (0)