Skip to content

Commit

Permalink
fix overloads api references
Browse files Browse the repository at this point in the history
  • Loading branch information
souporserious committed Jan 27, 2025
1 parent 3a904fb commit 72b8e58
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/wild-experts-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renoun': patch
---

Fixes `APIReference` documentation for overloads.
41 changes: 36 additions & 5 deletions packages/renoun/src/components/APIReference.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ async function APIReferenceAsync({
{/* {type.path && <ViewSource href={type.path} />} */}
</div>

{type.description ? (
{type.description &&
type.kind !== 'Function' &&
type.kind !== 'Component' ? (
<MDXRenderer value={type.description} components={mdxComponents} />
) : null}
</div>
Expand Down Expand Up @@ -288,11 +290,24 @@ function TypeChildren({
}}
>
{type.signatures.length > 1 ? (
<h4 css={{ margin: 0, marginBottom: '1rem' }}>Signatures</h4>
<h4 css={{ margin: 0, marginBottom: '1rem' }}>Overloads</h4>
) : null}
{type.signatures.map((signature, index) => {
return (
<Fragment key={index}>
<hr
css={{
border: 'none',
borderTop: '1px solid var(--color-separator-secondary)',
}}
/>
<CodeInline value={signature.text} language="typescript" />
{signature.description ? (
<MDXRenderer
value={signature.description}
components={mdxComponents}
/>
) : null}
{signature.parameter ? (
<div>
<h5 css={{ margin: '0' }}>Parameters</h5>
Expand Down Expand Up @@ -335,11 +350,24 @@ function TypeChildren({
}}
>
{type.signatures.length > 1 ? (
<h4 css={{ margin: 0, marginBottom: '1rem' }}>Signatures</h4>
<h4 css={{ margin: 0, marginBottom: '1rem' }}>Overloads</h4>
) : null}
{type.signatures.map((signature, index) => {
return (
<Fragment key={index}>
<hr
css={{
border: 'none',
borderTop: '1px solid var(--color-separator-secondary)',
}}
/>
<CodeInline value={signature.text} language="typescript" />
{signature.description ? (
<MDXRenderer
value={signature.description}
components={mdxComponents}
/>
) : null}
{signature.parameters.length > 0 ? (
<div>
<h5 css={{ margin: 0 }}>Parameters</h5>
Expand All @@ -349,9 +377,12 @@ function TypeChildren({
</div>
) : null}
{signature.returnType ? (
<div>
<div css={{ display: 'flex', flexDirection: 'column' }}>
<h5 css={{ margin: 0, marginBottom: '1.5rem' }}>Returns</h5>
{signature.returnType}
<CodeInline
value={signature.returnType}
language="typescript"
/>
</div>
) : null}
</Fragment>
Expand Down

0 comments on commit 72b8e58

Please sign in to comment.