interface SuperComponentProps { test1: { a: "1" | "2" }, test2: { a: "3" | "4" } helloworld: { b: "4" | "b" } }; function SuperComponent<T extends SuperComponentProps[keyof SuperComponentProps]>(props: T) { return <p>test 3</p>; } // HOW TO USE <SuperComponent<SuperComponentProps["test1"]> a="1" />
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter