Skip to content

Commit 62c013a

Browse files
committed
chore(docs): add a few tweaks in type extraction functions
1 parent db93464 commit 62c013a

File tree

4 files changed

+34
-18
lines changed

4 files changed

+34
-18
lines changed

apps/website/src/typeui/reduceReflectionsWith.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ import Indent from './Indent';
77
export default function reduceReflectionsWith(
88
punct: string | null,
99
params: Params,
10-
renderCurrent: (
11-
curr: JSONOutput.DeclarationReflection,
12-
params: Params
13-
) => any,
10+
renderCurrent: (curr: JSONOutput.DeclarationReflection, p: Params) => any,
1411
shouldBreak?: boolean
1512
) {
1613
return (prev: any, curr: JSONOutput.DeclarationReflection) => (

apps/website/src/typeui/renderReflection.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -257,15 +257,14 @@ export default function renderReflection(
257257
}
258258
return ret;
259259
case ReflectionKind.Method:
260-
return renderAttribute(
261-
reflection.name,
262-
renderArrowSignatures(
263-
reflection.signatures,
264-
params.withoutMemberLinks()
265-
),
266-
reflection.flags,
267-
params
268-
);
260+
return reflection.signatures.map((s) => {
261+
return renderAttribute(
262+
reflection.name,
263+
renderArrowSignatures([s], params.withoutMemberLinks()),
264+
reflection.flags,
265+
params
266+
);
267+
});
269268
case ReflectionKind.Function:
270269
return renderArrowSignatures(
271270
(reflection as JSONOutput.DeclarationReflection).signatures,

apps/website/src/typeui/renderType.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export default function renderType(pt: DeclarationType, params: Params) {
127127
</>
128128
);
129129
case 'mapped':
130-
const mapped = (pt as unknown) as JSONOutput.MappedType;
130+
const mapped = pt as unknown as JSONOutput.MappedType;
131131
nextParams = params.withIndent();
132132
return (
133133
<>
@@ -192,7 +192,7 @@ export default function renderType(pt: DeclarationType, params: Params) {
192192
</>
193193
);
194194
case 'indexedAccess':
195-
const acc = (pt as unknown) as JSONOutput.IndexedAccessType;
195+
const acc = pt as unknown as JSONOutput.IndexedAccessType;
196196
return (
197197
<>
198198
{renderType(acc.objectType, params)}

doc-tools/doc-docusaurus-typedoc-plugin/src/gen-pages.js

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-var-requires */
12
/* eslint-disable @typescript-eslint/no-unused-vars */
23
const { ReflectionKind } = require('typedoc');
34
const { writeFile, readdir, unlink } = require('fs/promises');
@@ -87,6 +88,21 @@ ${parseLinks(remarks.text)}
8788
`;
8889
}
8990

91+
/**
92+
*
93+
* @param {import('typedoc').JSONOutput.CommentTag} remarks
94+
*/
95+
function extractDeprecated(deprecated) {
96+
return `
97+
:::warning Deprecated
98+
99+
This feature will be removed in the next major release.
100+
${parseLinks(deprecated.text)}
101+
102+
:::
103+
`;
104+
}
105+
90106
/**
91107
*
92108
* @param {import('typedoc').JSONOutput.CommentTag} warnings
@@ -136,9 +152,13 @@ function extractAdmonitions(comment, isHeader) {
136152
const remarks = comment.tags && comment.tags.find((t) => t.tag === 'remarks');
137153
const warning = comment.tags && comment.tags.find((t) => t.tag === 'warning');
138154
const example = comment.tags && comment.tags.find((t) => t.tag === 'example');
139-
return `\n${remarks ? extractRemarks(remarks) : ''}${
140-
warning ? extractWarning(warning) : ''
141-
}${example ? extractExample(example, isHeader) : ''}\n\n`;
155+
const deprecated =
156+
comment.tags && comment.tags.find((t) => t.tag === 'deprecated');
157+
return `\n${deprecated ? extractDeprecated(deprecated) : ''}${
158+
remarks ? extractRemarks(remarks) : ''
159+
}${warning ? extractWarning(warning) : ''}${
160+
example ? extractExample(example, isHeader) : ''
161+
}\n\n`;
142162
}
143163

144164
/**

0 commit comments

Comments
 (0)