aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/apidoc/signature.ts9
-rw-r--r--scripts/apidoc/typedoc.ts9
2 files changed, 12 insertions, 6 deletions
diff --git a/scripts/apidoc/signature.ts b/scripts/apidoc/signature.ts
index d9e1cc44..7403e492 100644
--- a/scripts/apidoc/signature.ts
+++ b/scripts/apidoc/signature.ts
@@ -20,11 +20,11 @@ import vitepressConfig from '../../docs/.vitepress/config';
import { faker } from '../../src';
import { formatTypescript } from './format';
import {
+ extractDeprecated,
extractRawExamples,
extractSeeAlsos,
extractSince,
extractSourcePath,
- isDeprecated,
joinTagParts,
} from './typedoc';
import { pathOutputDir } from './utils';
@@ -178,7 +178,10 @@ export function analyzeSignature(
const seeAlsos = extractSeeAlsos(signature).map((seeAlso) =>
mdToHtml(seeAlso, true)
);
-
+ const deprecatedMessage = extractDeprecated(signature);
+ const deprecated = deprecatedMessage
+ ? mdToHtml(deprecatedMessage)
+ : undefined;
return {
name: methodName,
title: prettifyMethodName(methodName),
@@ -188,7 +191,7 @@ export function analyzeSignature(
sourcePath: extractSourcePath(signature),
returns: typeToText(signature.type),
examples: mdToHtml(`${code}ts\n${examples}${code}`),
- deprecated: isDeprecated(signature),
+ deprecated,
seeAlsos,
};
}
diff --git a/scripts/apidoc/typedoc.ts b/scripts/apidoc/typedoc.ts
index cc5132a9..43b2ac88 100644
--- a/scripts/apidoc/typedoc.ts
+++ b/scripts/apidoc/typedoc.ts
@@ -245,10 +245,13 @@ export function joinTagParts(parts?: CommentDisplayPart[]): string | undefined {
*
* @param signature The signature to check.
*
- * @returns `true` if it is deprecated, otherwise `false`.
+ * @returns The message explaining the deprecation if deprecated, otherwise `undefined`.
*/
-export function isDeprecated(signature: SignatureReflection): boolean {
- return extractTagContent('@deprecated', signature).length > 0;
+export function extractDeprecated(
+ signature: SignatureReflection
+): string | undefined {
+ const deprecated = extractTagContent('@deprecated', signature).join().trim();
+ return deprecated.length === 0 ? undefined : deprecated;
}
/**