Generic Type Provider

PHOTO EMBED

Sun Nov 21 2021 22:12:48 GMT+0000 (UTC)

Saved by @fescobalt #typescript

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" />
content_copyCOPY

Generic Types