mirror of
https://github.com/tabler/tabler-icons.git
synced 2025-09-08 21:30:40 +02:00
Set return type of Component in SolidJS to JSX.Element (#1148)
Co-authored-by: Bartłomiej Gawęda <bgaweda@abis.krakow.pl>
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { JSX } from 'solid-js/jsx-runtime';
|
||||||
import defaultAttributes from './defaultAttributes';
|
import defaultAttributes from './defaultAttributes';
|
||||||
import { splitProps } from 'solid-js';
|
import { splitProps } from 'solid-js';
|
||||||
import h from 'solid-js/h';
|
import h from 'solid-js/h';
|
||||||
@@ -9,7 +10,7 @@ const createSolidComponent = (
|
|||||||
iconNamePascal: string,
|
iconNamePascal: string,
|
||||||
iconNode: IconNode,
|
iconNode: IconNode,
|
||||||
) => {
|
) => {
|
||||||
const Component = (props: IconProps) => {
|
const Component = (props: IconProps): JSX.Element => {
|
||||||
const [localProps, rest] = splitProps(props, ['color', 'size', 'stroke', 'title', 'children', 'class']),
|
const [localProps, rest] = splitProps(props, ['color', 'size', 'stroke', 'title', 'children', 'class']),
|
||||||
attributes = defaultAttributes[type];
|
attributes = defaultAttributes[type];
|
||||||
|
|
||||||
@@ -39,7 +40,7 @@ const createSolidComponent = (
|
|||||||
...iconNode.map(([tag, attrs]) => h(tag, attrs)),
|
...iconNode.map(([tag, attrs]) => h(tag, attrs)),
|
||||||
localProps.children
|
localProps.children
|
||||||
],
|
],
|
||||||
);
|
) as unknown as JSX.Element;
|
||||||
};
|
};
|
||||||
|
|
||||||
Component.displayName = `${iconNamePascal}`;
|
Component.displayName = `${iconNamePascal}`;
|
||||||
|
Reference in New Issue
Block a user