ExportedTypes
Displays type documentation for all exported types from a module or source code value.
The ExportedTypes
component displays all exported types from a specific source
file path or a filename
and value
. This includes the inferred types from exported declarations, JSDoc descriptions, union types, and more.
import { ExportedTypes } from 'mdxts/components'
<ExportedTypes source="./components/Button.tsx" />
Use a child function to customize the output of ExportedTypes
to render type documentation however you like:
<ExportedTypes source="./MDXContent.tsx">
{(declarations) =>
declarations.map((declaration) => (
<div key={declaration.name}>
<h2>{declaration.name}</h2>
<p>{declaration.description}</p>
{declaration.types.length ? (
<ul>
{declaration.types.map((type) => (
<li key={type.name}>
<h3>{type.name}</h3>
<p>{type.description}</p>
</li>
))}
</ul>
) : null}
</div>
))
}
</ExportedTypes>
API Reference
ExportedTypes
View SourceExportedTypesProps
Union
source *
string
or
filename *
string
value *
string
children
( exportedTypes: ReturnType<typeof getExportedTypes> ) => React.ReactNode
Controls how types are rendered.