docz icon indicating copy to clipboard operation
docz copied to clipboard

Props of TypeScript Shape?

Open designbyadrian opened this issue 3 years ago • 0 comments

Can I output the props of a TypeScript shape (type or interface)?

Let's say I've got this component:

interface IItem {
  key: string;
  value: string;
}

type MyComponentProps = {
  items: IItem[];
}

function MyComponent({ items }): MyComponentProps {
  render <div></div?
}

If I use the docz Props component in my mdx file, I get this output:

<Props of={MyComponent} />
items  IItem[]

Is there a way to automatically render the IITem interface so that readers can understand how this array should look?

designbyadrian avatar May 02 '21 16:05 designbyadrian