MCPcopy Create free account
hub / github.com/denoland/std / assertConstructorDocs

Function assertConstructorDocs

_tools/check_docs.ts:328–344  ·  view source on GitHub ↗

* Checks a constructor document for: * - No TypeScript parameters marked with `public`, `protected`, or `private`. * - A code https://jsdoc.app/tags-param | @param tag for each parameter. * - At least one code https://jsdoc.app/tags-example | @example tag with * a code snippet th

(
  constructor: DocNodeWithJsDoc<ClassConstructorDef>,
)

Source from the content-addressed store, hash-verified

326 * a code snippet that executes successfully.
327 */
328function assertConstructorDocs(
329 constructor: DocNodeWithJsDoc<ClassConstructorDef>,
330) {
331 for (const param of constructor.params) {
332 assert(
333 param.accessibility === undefined,
334 "Do not use `public`, `protected`, or `private` parameters in constructors",
335 constructor,
336 );
337 if (param.kind === "identifier") {
338 assertHasParamTag(constructor, param.name);
339 }
340 if (param.kind === "assign" && param.left.kind === "identifier") {
341 assertHasParamTag(constructor, param.left.name);
342 }
343 }
344}
345
346/**
347 * Checks a module document for:

Callers 1

assertClassDocsFunction · 0.85

Calls 2

assertHasParamTagFunction · 0.85
assertFunction · 0.70

Tested by

no test coverage detected