diff --git a/packages/website/src/components/MethodItem.tsx b/packages/website/src/components/MethodItem.tsx index 8b3dd7be7..effa41993 100644 --- a/packages/website/src/components/MethodItem.tsx +++ b/packages/website/src/components/MethodItem.tsx @@ -11,10 +11,10 @@ type MethodResolvable = ApiMethodJSON | ApiMethodSignatureJSON; function getShorthandName(data: MethodResolvable) { return `${data.name}${data.optional ? '?' : ''}(${data.parameters.reduce((prev, cur, index) => { if (index === 0) { - return `${prev}${cur.isOptional ? `[${cur.name}]` : cur.name}`; + return `${prev}${cur.isOptional ? `${cur.name}?` : cur.name}`; } - return `${prev}, ${cur.isOptional ? `[${cur.name}]` : cur.name}`; + return `${prev}, ${cur.isOptional ? `${cur.name}?` : cur.name}`; }, '')})`; } diff --git a/packages/website/src/components/Sections.tsx b/packages/website/src/components/Sections.tsx index f190681a6..4fbbfbc7c 100644 --- a/packages/website/src/components/Sections.tsx +++ b/packages/website/src/components/Sections.tsx @@ -43,15 +43,14 @@ export function ParametersSection({ data }: { data: ParameterDocumentation[] }) export function ConstructorSection({ data }: { data: ApiConstructorJSON }) { const matches = useMediaQuery('(max-width: 768px)', true, { getInitialValueInEffect: false }); - function getShorthandName(): string { - return `constructor(${data.parameters.reduce((prev, cur, index) => { + const getShorthandName = () => + `constructor(${data.parameters.reduce((prev, cur, index) => { if (index === 0) { - return `${prev}${cur.isOptional ? `[${cur.name}]` : cur.name}`; + return `${prev}${cur.isOptional ? `${cur.name}?` : cur.name}`; } - return `${prev}, ${cur.isOptional ? `[${cur.name}]` : cur.name}`; + return `${prev}, ${cur.isOptional ? `${cur.name}?` : cur.name}`; }, '')})`; - } return data.parameters.length ? (
} padded dense={matches}>