Skip to content

Commit 4fad9dd

Browse files
committed
docs: fix param check
1 parent 3793ec1 commit 4fad9dd

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

scripts/apidoc/signature.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ function analyzeParameterOptions(
243243
description: mdToHtml(
244244
toBlock(
245245
property.comment ??
246-
(property.type as ReflectionType)?.declaration.signatures?.[0]
246+
(property.type as ReflectionType)?.declaration?.signatures?.[0]
247247
.comment
248248
)
249249
),

src/modules/helpers/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ export class HelpersModule {
396396
/**
397397
* Returns a random key from given object or `undefined` if no key could be found.
398398
*
399+
* @template T The type of the object to select from.
399400
* @param object The object to be used.
400401
*
401402
* @example
@@ -411,6 +412,7 @@ export class HelpersModule {
411412
/**
412413
* Returns a random value from given object or `undefined` if no key could be found.
413414
*
415+
* @template T The type of object to select from.
414416
* @param object The object to be used.
415417
*
416418
* @example
@@ -788,6 +790,7 @@ export class HelpersModule {
788790
/**
789791
* Generates an array containing values returned by the given method.
790792
*
793+
* @template T The type of elements.
791794
* @param method The method used to generate the values.
792795
* @param options The optional options object.
793796
* @param options.count The number or range of elements to generate. Defaults to `3`.

test/scripts/apidoc/examplesAndDeprecations.spec.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,20 @@ import { resolve } from 'node:path';
33
import type { DeclarationReflection, SignatureReflection } from 'typedoc';
44
import { ReflectionKind } from 'typedoc';
55
import type { SpyInstance } from 'vitest';
6-
import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest';
6+
import {
7+
afterAll,
8+
beforeAll,
9+
beforeEach,
10+
describe,
11+
expect,
12+
it,
13+
vi,
14+
} from 'vitest';
715
import { selectApiModules } from '../../../scripts/apidoc/moduleMethods';
16+
import {
17+
analyzeSignature,
18+
initMarkdownRenderer,
19+
} from '../../../scripts/apidoc/signature';
820
import {
921
extractRawExamples,
1022
extractSeeAlsos,
@@ -27,6 +39,8 @@ const locales: Record<string, string> = {
2739
DE: 'de',
2840
};
2941

42+
beforeAll(initMarkdownRenderer);
43+
3044
describe('examples and deprecations', () => {
3145
const project = loadProject();
3246

@@ -107,6 +121,18 @@ describe('examples and deprecations', () => {
107121
}
108122
}
109123

124+
// Verify @param tags
125+
analyzeSignature(signature, moduleName, methodName).parameters.forEach(
126+
(param) => {
127+
const { name, description } = param;
128+
const plainDescription = description.replace(/<[^>]+>/g, '').trim();
129+
expect(
130+
plainDescription,
131+
`Expect param ${name} to have a description`
132+
).not.toBe('Missing');
133+
}
134+
);
135+
110136
// Verify @see tag
111137
extractSeeAlsos(signature).forEach((link) => {
112138
if (link.startsWith('faker.')) {

0 commit comments

Comments
 (0)