diff --git a/src/index.test.tsx b/src/index.test.tsx index e589d18..d971b4e 100644 --- a/src/index.test.tsx +++ b/src/index.test.tsx @@ -234,4 +234,12 @@ describe("twc", () => { >`py-2`; render(); }); + + test("allows svg", () => { + const Svg = twc.svg`text-xl`; + render(); + const svg = screen.getByTestId("svg"); + expect(svg).toBeDefined(); + expect(svg.tagName).toBe("SVG"); + }); }); diff --git a/src/index.tsx b/src/index.tsx index 291e4b5..8ee8921 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -40,6 +40,11 @@ type Template< ResultProps >; +type ElementTagName = Exclude< + keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap, + "set" +>; + type FirstLevelTemplate< TComponent extends React.ElementType, TCompose extends AbstractCompose, @@ -57,7 +62,7 @@ type FirstLevelTemplate< type Twc = (( component: T, ) => FirstLevelTemplate) & { - [Key in keyof HTMLElementTagNameMap]: FirstLevelTemplate< + [Key in ElementTagName]: FirstLevelTemplate< Key, TCompose, { asChild?: boolean }