mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
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:
parent
a608ab08ab
commit
934784c588
@ -1,5 +1,10 @@
|
|||||||
import { ElementFor } from "./element";
|
import { ElementFor } from "./element";
|
||||||
import type React from "react";
|
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 const Div = ElementFor<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>("div");
|
||||||
|
export type DivProps = PropsByElement<typeof Div>;
|
||||||
|
|
||||||
export const Span = ElementFor<HTMLSpanElement, React.HTMLAttributes<HTMLSpanElement>>("span");
|
export const Span = ElementFor<HTMLSpanElement, React.HTMLAttributes<HTMLSpanElement>>("span");
|
||||||
|
export type SpanProps = PropsByElement<typeof Span>;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user