fix(website): switch signature with overload (#9643)

This commit is contained in:
brynpttrsn 2023-06-13 14:55:56 -04:00 committed by GitHub
parent cd6986854f
commit 7b494aca5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,6 +5,7 @@ import type {
ApiMethodSignature,
} from '@microsoft/api-extractor-model';
import dynamic from 'next/dynamic';
import { Fragment } from 'react';
import { MethodDocumentation } from './MethodDocumentation';
import { MethodHeader } from './MethodHeader';
@ -20,17 +21,14 @@ export function Method({
if (method.getMergedSiblings().length > 1) {
// We have overloads, use the overload switcher, but render
// each overload node on the server.
const overloads = method
.getMergedSiblings()
.map((sibling, idx) => (
<MethodDocumentation key={`${sibling.displayName}-${idx}`} method={sibling as ApiMethod | ApiMethodSignature} />
));
const overloads = method.getMergedSiblings().map((sibling, idx) => (
<Fragment key={`${sibling.displayName}-${idx}`}>
<MethodHeader method={sibling as ApiMethod | ApiMethodSignature} />
<MethodDocumentation method={sibling as ApiMethod | ApiMethodSignature} />
</Fragment>
));
return (
<OverloadSwitcher overloads={overloads}>
<MethodHeader method={method} />
</OverloadSwitcher>
);
return <OverloadSwitcher overloads={overloads} />;
}
// We have just a single method, render it on the server.