Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
578 B
1
Indexable
Never
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
})