chore: Export types for reusable props for Elements

Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne SavolainenandMikko Aspiala committed 2023-04-17 12:08:28 +03:00
1 parent a608ab08ab
commit 934784c588
1 file changed
+5
@@ -1,5 +1,10 @@
import { ElementFor } from "./element";
import type React from "react";
type PropsByElement<T> = T extends React.ComponentType<infer I> ? I : never;
export const Div = ElementFor<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>("div");
export type DivProps = PropsByElement<typeof Div>;
export const Span = ElementFor<HTMLSpanElement, React.HTMLAttributes<HTMLSpanElement>>("span");
export type SpanProps = PropsByElement<typeof Span>;