/* eslint-disable no-nested-ternary */
// https://github.com/TypeStrong/typedoc-default-themes/blob/master/src/default/partials/member.signature.title.hbs
import { Fragment } from 'react';
import type { TSDSignatureReflection } from '../types';
import { escapeMdx } from '../utils/helpers';
import { Type } from './Type';
import { TypeParametersGeneric } from './TypeParametersGeneric';
export interface MemberSignatureTitleProps {
useArrow?: boolean;
hideName?: boolean;
sig: TSDSignatureReflection;
}
export function MemberSignatureTitle({ useArrow, hideName, sig }: MemberSignatureTitleProps) {
return (
<>
{!hideName && sig.name !== '__type' ? (
escapeMdx(sig.name)
) : // Constructor signature
sig.kind === 16_384 ? (
<>
{sig.flags?.isAbstract && abstract }
new
>
) : null}
(
{sig.parameters?.map((param, index) => (
{index > 0 && , }
{param.flags?.isRest && ...}
{param.name}
{(param.flags?.isOptional || 'defaultValue' in param) && '?'}
{': '}
))}
)
{sig.type && (
<>
{useArrow ? ' => ' : ': '}
>
)}
>
);
}