Untitled
unknown
plain_text
3 years ago
578 B
10
Indexable
type ElementTypes = "Button" | "ButtonLink" | "Alert"
const Component = (elementType: ElementTypes) => ({
setId: (id: string) => ({
elementType, id
})
})
const clickstreams = {
nextButton: Component("Button").setId("next"),
myAlert: Component("Alert").setId("someAlert")
}
type MyButtonProps = {
onClick?: () => void;
elementType: {
elementType: "Button",
id: string
}
}
const MyButton = ({}: MyButtonProps) => "React.ReactNode";
MyButton({
elementType: clickstreams.nextButton
})
Editor is loading...