mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(website): always link in TypeAlias (#10105)
* fix(website): always link in TypeAlias * fix: use div instead span for DocParagraph
This commit is contained in:
@@ -4,7 +4,7 @@ import { useMemo } from 'react';
|
||||
import { ExcerptText } from '~/components/ExcerptText';
|
||||
import { DocumentationSection } from './DocumentationSection';
|
||||
|
||||
export type UnionMember = ExcerptToken[];
|
||||
export type UnionMember = readonly ExcerptToken[];
|
||||
|
||||
export function UnionMembersSection({
|
||||
item,
|
||||
|
||||
@@ -25,9 +25,9 @@ export function TSDoc({ item, tsdoc }: { readonly item: ApiItem; readonly tsdoc:
|
||||
case DocNodeKind.Section:
|
||||
case DocNodeKind.Paragraph:
|
||||
return (
|
||||
<span className="break-words leading-relaxed" key={idx}>
|
||||
<div className="break-words leading-relaxed" key={idx}>
|
||||
{(tsdoc as DocNodeContainer).nodes.map((node, idx) => createNode(node, idx))}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
case DocNodeKind.SoftBreak:
|
||||
return <Fragment key={idx} />;
|
||||
|
||||
@@ -13,16 +13,10 @@ export function TypeAlias({ item }: { readonly item: ApiTypeAlias }) {
|
||||
let depth = 0;
|
||||
for (const token of item.typeExcerpt.spannedTokens) {
|
||||
if (token.text.includes('?')) {
|
||||
return [];
|
||||
return [item.typeExcerpt.spannedTokens];
|
||||
}
|
||||
|
||||
if (token.text.includes('<')) {
|
||||
depth++;
|
||||
}
|
||||
|
||||
if (token.text.includes('>')) {
|
||||
depth--;
|
||||
}
|
||||
depth += token.text.split('<').length - token.text.split('>').length;
|
||||
|
||||
if (token.text.trim() === '|' && depth === 0) {
|
||||
if (currentUnionMember.length) {
|
||||
@@ -47,7 +41,7 @@ export function TypeAlias({ item }: { readonly item: ApiTypeAlias }) {
|
||||
}
|
||||
}
|
||||
|
||||
if (currentUnionMember.length && union.length) {
|
||||
if (currentUnionMember.length) {
|
||||
union.push(currentUnionMember);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user