mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 13:03:31 +01:00
fix(website): switch signature with overload (#9643)
This commit is contained in:
@@ -5,6 +5,7 @@ import type {
|
|||||||
ApiMethodSignature,
|
ApiMethodSignature,
|
||||||
} from '@microsoft/api-extractor-model';
|
} from '@microsoft/api-extractor-model';
|
||||||
import dynamic from 'next/dynamic';
|
import dynamic from 'next/dynamic';
|
||||||
|
import { Fragment } from 'react';
|
||||||
import { MethodDocumentation } from './MethodDocumentation';
|
import { MethodDocumentation } from './MethodDocumentation';
|
||||||
import { MethodHeader } from './MethodHeader';
|
import { MethodHeader } from './MethodHeader';
|
||||||
|
|
||||||
@@ -20,17 +21,14 @@ export function Method({
|
|||||||
if (method.getMergedSiblings().length > 1) {
|
if (method.getMergedSiblings().length > 1) {
|
||||||
// We have overloads, use the overload switcher, but render
|
// We have overloads, use the overload switcher, but render
|
||||||
// each overload node on the server.
|
// each overload node on the server.
|
||||||
const overloads = method
|
const overloads = method.getMergedSiblings().map((sibling, idx) => (
|
||||||
.getMergedSiblings()
|
<Fragment key={`${sibling.displayName}-${idx}`}>
|
||||||
.map((sibling, idx) => (
|
<MethodHeader method={sibling as ApiMethod | ApiMethodSignature} />
|
||||||
<MethodDocumentation key={`${sibling.displayName}-${idx}`} method={sibling as ApiMethod | ApiMethodSignature} />
|
<MethodDocumentation method={sibling as ApiMethod | ApiMethodSignature} />
|
||||||
));
|
</Fragment>
|
||||||
|
));
|
||||||
|
|
||||||
return (
|
return <OverloadSwitcher overloads={overloads} />;
|
||||||
<OverloadSwitcher overloads={overloads}>
|
|
||||||
<MethodHeader method={method} />
|
|
||||||
</OverloadSwitcher>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have just a single method, render it on the server.
|
// We have just a single method, render it on the server.
|
||||||
|
|||||||
Reference in New Issue
Block a user