typedoc 0.26.1 → 0.26.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/lib/converter/comments/discovery.d.ts +4 -7
  2. package/dist/lib/converter/comments/discovery.js +144 -75
  3. package/dist/lib/converter/comments/index.d.ts +7 -4
  4. package/dist/lib/converter/comments/index.js +22 -16
  5. package/dist/lib/converter/comments/parser.js +5 -0
  6. package/dist/lib/converter/comments/textParser.js +12 -6
  7. package/dist/lib/converter/context.js +5 -5
  8. package/dist/lib/converter/converter.d.ts +0 -2
  9. package/dist/lib/converter/converter.js +5 -12
  10. package/dist/lib/converter/plugins/CommentPlugin.js +1 -1
  11. package/dist/lib/internationalization/locales/jp.cjs +2 -2
  12. package/dist/lib/internationalization/locales/jp.d.cts +1 -320
  13. package/dist/lib/internationalization/locales/ko.d.cts +1 -230
  14. package/dist/lib/internationalization/locales/zh.cjs +2 -2
  15. package/dist/lib/internationalization/locales/zh.d.cts +1 -320
  16. package/dist/lib/internationalization/translatable.d.ts +4 -4
  17. package/dist/lib/internationalization/translatable.js +2 -2
  18. package/dist/lib/models/FileRegistry.js +3 -4
  19. package/dist/lib/models/comments/comment.d.ts +7 -0
  20. package/dist/lib/models/comments/comment.js +15 -1
  21. package/dist/lib/output/events.d.ts +20 -7
  22. package/dist/lib/output/events.js +20 -0
  23. package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +3 -2
  24. package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +0 -2
  25. package/dist/lib/output/themes/default/partials/members.d.ts +1 -1
  26. package/dist/lib/output/themes/default/partials/members.js +39 -9
  27. package/dist/lib/output/themes/default/partials/navigation.js +27 -7
  28. package/dist/lib/utils/array.d.ts +3 -0
  29. package/dist/lib/utils/array.js +19 -0
  30. package/dist/lib/utils/enum.d.ts +3 -3
  31. package/dist/lib/utils/highlighter.js +1 -1
  32. package/dist/lib/utils/options/declaration.d.ts +2 -1
  33. package/dist/lib/utils/options/sources/typedoc.js +5 -0
  34. package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
  35. package/dist/lib/utils/options/tsdoc-defaults.js +2 -1
  36. package/package.json +7 -7
  37. package/static/style.css +10 -0
  38. package/tsdoc.json +4 -0
  39. package/dist/lib/output/themes/default/partials/members.group.d.ts +0 -4
  40. package/dist/lib/output/themes/default/partials/members.group.js +0 -25
@@ -6,12 +6,9 @@ export interface DiscoveredComment {
6
6
  file: ts.SourceFile;
7
7
  ranges: ts.CommentRange[];
8
8
  jsDoc: ts.JSDoc | undefined;
9
+ inheritedFromParentDeclaration: boolean;
9
10
  }
10
- export declare function discoverFileComments(node: ts.SourceFile, commentStyle: CommentStyle): {
11
- file: ts.SourceFile;
12
- ranges: ts.CommentRange[];
13
- jsDoc: ts.JSDoc | undefined;
14
- }[];
11
+ export declare function discoverFileComments(node: ts.SourceFile, commentStyle: CommentStyle): DiscoveredComment[];
15
12
  export declare function discoverNodeComment(node: ts.Node, commentStyle: CommentStyle): DiscoveredComment | undefined;
16
- export declare function discoverComment(symbol: ts.Symbol, kind: ReflectionKind, logger: Logger, commentStyle: CommentStyle): DiscoveredComment | undefined;
17
- export declare function discoverSignatureComment(declaration: ts.SignatureDeclaration | ts.JSDocSignature, commentStyle: CommentStyle): DiscoveredComment | undefined;
13
+ export declare function discoverComment(symbol: ts.Symbol, kind: ReflectionKind, logger: Logger, commentStyle: CommentStyle, checker: ts.TypeChecker): DiscoveredComment | undefined;
14
+ export declare function discoverSignatureComment(declaration: ts.SignatureDeclaration | ts.JSDocSignature, checker: ts.TypeChecker, commentStyle: CommentStyle): DiscoveredComment | undefined;
@@ -13,6 +13,7 @@ const utils_1 = require("../../utils");
13
13
  const declaration_1 = require("../../utils/options/declaration");
14
14
  const paths_1 = require("../../utils/paths");
15
15
  const assert_1 = require("assert");
16
+ const array_1 = require("../../utils/array");
16
17
  const variablePropertyKinds = [
17
18
  typescript_1.default.SyntaxKind.PropertyDeclaration,
18
19
  typescript_1.default.SyntaxKind.PropertySignature,
@@ -128,6 +129,7 @@ function discoverFileComments(node, commentStyle) {
128
129
  file: node,
129
130
  ranges,
130
131
  jsDoc: findJsDocForComment(node, ranges),
132
+ inheritedFromParentDeclaration: false,
131
133
  };
132
134
  });
133
135
  }
@@ -141,99 +143,119 @@ function discoverNodeComment(node, commentStyle) {
141
143
  file: node.getSourceFile(),
142
144
  ranges: selectedDocComment,
143
145
  jsDoc: findJsDocForComment(node, selectedDocComment),
146
+ inheritedFromParentDeclaration: false,
144
147
  };
145
148
  }
146
149
  }
147
- function discoverComment(symbol, kind, logger, commentStyle) {
150
+ function checkCommentDeclarations(commentNodes, reverse, commentStyle) {
151
+ const discovered = [];
152
+ for (const { node, inheritedFromParentDeclaration } of commentNodes) {
153
+ const text = node.getSourceFile().text;
154
+ const comments = collectCommentRanges(typescript_1.default.getLeadingCommentRanges(text, node.pos));
155
+ if (reverse) {
156
+ comments.reverse();
157
+ }
158
+ const selectedDocComment = comments.find((ranges) => permittedRange(text, ranges, commentStyle));
159
+ if (selectedDocComment) {
160
+ discovered.push({
161
+ file: node.getSourceFile(),
162
+ ranges: selectedDocComment,
163
+ jsDoc: findJsDocForComment(node, selectedDocComment),
164
+ inheritedFromParentDeclaration,
165
+ });
166
+ }
167
+ }
168
+ return discovered;
169
+ }
170
+ function discoverComment(symbol, kind, logger, commentStyle, checker) {
148
171
  // For a module comment, we want the first one defined in the file,
149
172
  // not the last one, since that will apply to the import or declaration.
150
173
  const reverse = !symbol.declarations?.some(typescript_1.default.isSourceFile);
151
- const discovered = [];
152
- const seen = new Set();
153
- for (const decl of symbol.declarations || []) {
154
- const text = decl.getSourceFile().text;
155
- if (wantedKinds[kind].includes(decl.kind)) {
156
- const node = declarationToCommentNode(decl);
157
- if (!node || seen.has(node)) {
158
- continue;
159
- }
160
- seen.add(node);
161
- // Special behavior here!
162
- // Signatures and symbols have two distinct discovery methods as of TypeDoc 0.26.
163
- // This method discovers comments for symbols, and function-likes will only have
164
- // a symbol comment if there is more than one signature (== more than one declaration)
165
- // and there is a comment on the implementation signature.
166
- if (kind & models_1.ReflectionKind.ContainsCallSignatures &&
167
- [
168
- typescript_1.default.SyntaxKind.FunctionDeclaration,
169
- typescript_1.default.SyntaxKind.MethodDeclaration,
170
- typescript_1.default.SyntaxKind.Constructor,
171
- ].includes(node.kind) &&
172
- (symbol.declarations.filter((d) => wantedKinds[kind].includes(d.kind)).length === 1 ||
173
- !node.body)) {
174
- continue;
175
- }
176
- const comments = collectCommentRanges(typescript_1.default.getLeadingCommentRanges(text, node.pos));
177
- if (reverse) {
178
- comments.reverse();
179
- }
180
- const selectedDocComment = comments.find((ranges) => permittedRange(text, ranges, commentStyle));
181
- if (selectedDocComment) {
182
- discovered.push({
183
- file: decl.getSourceFile(),
184
- ranges: selectedDocComment,
185
- jsDoc: findJsDocForComment(node, selectedDocComment),
174
+ const wantedDeclarations = (0, array_1.filter)(symbol.declarations, (decl) => wantedKinds[kind].includes(decl.kind));
175
+ const commentNodes = wantedDeclarations.flatMap((decl) => declarationToCommentNodes(decl, checker));
176
+ // Special behavior here!
177
+ // Signatures and symbols have two distinct discovery methods as of TypeDoc 0.26.
178
+ // This method discovers comments for symbols, and function-likes will only have
179
+ // a symbol comment if there is more than one signature (== more than one declaration)
180
+ // and there is a comment on the implementation signature.
181
+ if (kind & models_1.ReflectionKind.ContainsCallSignatures) {
182
+ const canHaveOverloads = wantedDeclarations.some((node) => [
183
+ typescript_1.default.SyntaxKind.FunctionDeclaration,
184
+ typescript_1.default.SyntaxKind.MethodDeclaration,
185
+ typescript_1.default.SyntaxKind.Constructor,
186
+ ].includes(node.kind));
187
+ const isOverloaded = canHaveOverloads && wantedDeclarations.length > 1;
188
+ if (isOverloaded) {
189
+ commentNodes.length = 0;
190
+ const implementationNode = wantedDeclarations.find((node) => node.body);
191
+ if (implementationNode) {
192
+ commentNodes.push({
193
+ node: implementationNode,
194
+ inheritedFromParentDeclaration: false,
186
195
  });
187
196
  }
188
197
  }
198
+ else if (canHaveOverloads) {
199
+ // Single signature function, function reflection doesn't get a comment,
200
+ // the signatures do.
201
+ commentNodes.length = 0;
202
+ }
203
+ else {
204
+ // Variable declaration which happens to include signatures.
205
+ }
189
206
  }
207
+ const discovered = checkCommentDeclarations(commentNodes, reverse, commentStyle);
190
208
  switch (discovered.length) {
191
209
  case 0:
192
210
  return undefined;
193
211
  case 1:
194
212
  return discovered[0];
195
213
  default: {
196
- logger.warn(logger.i18n.symbol_0_has_multiple_declarations_with_comment(symbol.name));
197
- const locations = discovered.map(({ file, ranges: [{ pos }] }) => {
198
- const path = (0, paths_1.nicePath)(file.fileName);
199
- const line = typescript_1.default.getLineAndCharacterOfPosition(file, pos).line + 1;
200
- return `${path}:${line}`;
201
- });
202
- logger.info(logger.i18n.comments_for_0_are_declared_at_1(symbol.name, locations.join("\n\t")));
214
+ if (discovered.filter((n) => !n.inheritedFromParentDeclaration)
215
+ .length > 1) {
216
+ logger.warn(logger.i18n.symbol_0_has_multiple_declarations_with_comment(symbol.name));
217
+ const locations = discovered.map(({ file, ranges: [{ pos }] }) => {
218
+ const path = (0, paths_1.nicePath)(file.fileName);
219
+ const line = typescript_1.default.getLineAndCharacterOfPosition(file, pos).line +
220
+ 1;
221
+ return `${path}:${line}`;
222
+ });
223
+ logger.info(logger.i18n.comments_for_0_are_declared_at_1(symbol.name, locations.join("\n\t")));
224
+ }
203
225
  return discovered[0];
204
226
  }
205
227
  }
206
228
  }
207
- function discoverSignatureComment(declaration, commentStyle) {
208
- const node = declarationToCommentNode(declaration);
209
- if (!node) {
210
- return;
211
- }
212
- if (typescript_1.default.isJSDocSignature(node)) {
213
- const comment = node.parent.parent;
214
- (0, assert_1.ok)(typescript_1.default.isJSDoc(comment));
215
- return {
216
- file: node.getSourceFile(),
217
- ranges: [
218
- {
219
- kind: typescript_1.default.SyntaxKind.MultiLineCommentTrivia,
220
- pos: comment.pos,
221
- end: comment.end,
222
- },
223
- ],
224
- jsDoc: comment,
225
- };
226
- }
227
- const text = node.getSourceFile().text;
228
- const comments = collectCommentRanges(typescript_1.default.getLeadingCommentRanges(text, node.pos));
229
- comments.reverse();
230
- const comment = comments.find((ranges) => permittedRange(text, ranges, commentStyle));
231
- if (comment) {
232
- return {
233
- file: node.getSourceFile(),
234
- ranges: comment,
235
- jsDoc: findJsDocForComment(node, comment),
236
- };
229
+ function discoverSignatureComment(declaration, checker, commentStyle) {
230
+ for (const { node, inheritedFromParentDeclaration, } of declarationToCommentNodes(declaration, checker)) {
231
+ if (typescript_1.default.isJSDocSignature(node)) {
232
+ const comment = node.parent.parent;
233
+ (0, assert_1.ok)(typescript_1.default.isJSDoc(comment));
234
+ return {
235
+ file: node.getSourceFile(),
236
+ ranges: [
237
+ {
238
+ kind: typescript_1.default.SyntaxKind.MultiLineCommentTrivia,
239
+ pos: comment.pos,
240
+ end: comment.end,
241
+ },
242
+ ],
243
+ jsDoc: comment,
244
+ inheritedFromParentDeclaration,
245
+ };
246
+ }
247
+ const text = node.getSourceFile().text;
248
+ const comments = collectCommentRanges(typescript_1.default.getLeadingCommentRanges(text, node.pos));
249
+ comments.reverse();
250
+ const comment = comments.find((ranges) => permittedRange(text, ranges, commentStyle));
251
+ if (comment) {
252
+ return {
253
+ file: node.getSourceFile(),
254
+ ranges: comment,
255
+ jsDoc: findJsDocForComment(node, comment),
256
+ inheritedFromParentDeclaration,
257
+ };
258
+ }
237
259
  }
238
260
  }
239
261
  function findJsDocForComment(node, ranges) {
@@ -282,7 +304,7 @@ function getRootModuleDeclaration(node) {
282
304
  }
283
305
  return node;
284
306
  }
285
- function declarationToCommentNode(node) {
307
+ function declarationToCommentNodeIgnoringParents(node) {
286
308
  // ts.SourceFile is a counterexample
287
309
  if (!node.parent)
288
310
  return node;
@@ -324,7 +346,54 @@ function declarationToCommentNode(node) {
324
346
  if (typescript_1.default.SyntaxKind.NamespaceExport === node.kind) {
325
347
  return node.parent;
326
348
  }
327
- return node;
349
+ }
350
+ function declarationToCommentNodes(node, checker) {
351
+ const commentNode = declarationToCommentNodeIgnoringParents(node);
352
+ if (commentNode) {
353
+ return [
354
+ {
355
+ node: commentNode,
356
+ inheritedFromParentDeclaration: false,
357
+ },
358
+ ];
359
+ }
360
+ const result = [
361
+ {
362
+ node,
363
+ inheritedFromParentDeclaration: false,
364
+ },
365
+ ];
366
+ const seenSymbols = new Set();
367
+ const bases = findBaseOfDeclaration(checker, node, (symbol) => {
368
+ if (!seenSymbols.has(symbol)) {
369
+ seenSymbols.add(symbol);
370
+ return symbol.declarations?.map((node) => declarationToCommentNodeIgnoringParents(node) || node);
371
+ }
372
+ });
373
+ for (const parentCommentNode of bases || []) {
374
+ result.push({
375
+ node: parentCommentNode,
376
+ inheritedFromParentDeclaration: true,
377
+ });
378
+ }
379
+ return result;
380
+ }
381
+ // Lifted from the TS source, with a couple minor modifications
382
+ function findBaseOfDeclaration(checker, declaration, cb) {
383
+ const classOrInterfaceDeclaration = declaration.parent?.kind === typescript_1.default.SyntaxKind.Constructor
384
+ ? declaration.parent.parent
385
+ : declaration.parent;
386
+ if (!classOrInterfaceDeclaration)
387
+ return;
388
+ const isStaticMember = typescript_1.default.getCombinedModifierFlags(declaration) & typescript_1.default.ModifierFlags.Static;
389
+ return (0, array_1.firstDefined)(typescript_1.default.getAllSuperTypeNodes(classOrInterfaceDeclaration), (superTypeNode) => {
390
+ const baseType = checker.getTypeAtLocation(superTypeNode);
391
+ const type = isStaticMember && baseType.symbol
392
+ ? checker.getTypeOfSymbol(baseType.symbol)
393
+ : baseType;
394
+ const symbol = checker.getPropertyOfType(type, declaration.symbol.name);
395
+ return symbol ? cb(symbol) : undefined;
396
+ });
328
397
  }
329
398
  /**
330
399
  * Separate comment ranges into arrays so that multiple line comments are kept together
@@ -8,10 +8,13 @@ export interface CommentParserConfig {
8
8
  inlineTags: Set<string>;
9
9
  modifierTags: Set<string>;
10
10
  jsDocCompatibility: JsDocCompatibility;
11
+ suppressCommentWarningsInDeclarationFiles: boolean;
12
+ useTsLinkResolution: boolean;
13
+ commentStyle: CommentStyle;
11
14
  }
12
15
  export declare function clearCommentCache(): void;
13
- export declare function getComment(symbol: ts.Symbol, kind: ReflectionKind, config: CommentParserConfig, logger: Logger, commentStyle: CommentStyle, checker: ts.TypeChecker | undefined, files: FileRegistry): Comment | undefined;
14
- export declare function getNodeComment(node: ts.Node, moduleComment: boolean, config: CommentParserConfig, logger: Logger, commentStyle: CommentStyle, checker: ts.TypeChecker | undefined, files: FileRegistry): Comment | undefined;
15
- export declare function getFileComment(file: ts.SourceFile, config: CommentParserConfig, logger: Logger, commentStyle: CommentStyle, checker: ts.TypeChecker | undefined, files: FileRegistry): Comment | undefined;
16
- export declare function getSignatureComment(declaration: ts.SignatureDeclaration | ts.JSDocSignature, config: CommentParserConfig, logger: Logger, commentStyle: CommentStyle, checker: ts.TypeChecker | undefined, files: FileRegistry): Comment | undefined;
16
+ export declare function getComment(symbol: ts.Symbol, kind: ReflectionKind, config: CommentParserConfig, logger: Logger, checker: ts.TypeChecker, files: FileRegistry): Comment | undefined;
17
+ export declare function getNodeComment(node: ts.Node, moduleComment: boolean, config: CommentParserConfig, logger: Logger, checker: ts.TypeChecker | undefined, files: FileRegistry): Comment | undefined;
18
+ export declare function getFileComment(file: ts.SourceFile, config: CommentParserConfig, logger: Logger, checker: ts.TypeChecker | undefined, files: FileRegistry): Comment | undefined;
19
+ export declare function getSignatureComment(declaration: ts.SignatureDeclaration | ts.JSDocSignature, config: CommentParserConfig, logger: Logger, checker: ts.TypeChecker, files: FileRegistry): Comment | undefined;
17
20
  export declare function getJsDocComment(declaration: ts.JSDocPropertyLikeTag | ts.JSDocCallbackTag | ts.JSDocTypedefTag | ts.JSDocTemplateTag | ts.JSDocEnumTag, config: CommentParserConfig, logger: Logger, checker: ts.TypeChecker | undefined, files: FileRegistry): Comment | undefined;
@@ -38,7 +38,10 @@ function getCommentWithCache(discovered, config, logger, checker, files) {
38
38
  const { file, ranges, jsDoc } = discovered;
39
39
  const cache = commentCache.get(file) || new Map();
40
40
  if (cache.has(ranges[0].pos)) {
41
- return cache.get(ranges[0].pos).clone();
41
+ const clone = cache.get(ranges[0].pos).clone();
42
+ clone.inheritedFromParentDeclaration =
43
+ discovered.inheritedFromParentDeclaration;
44
+ return clone;
42
45
  }
43
46
  let comment;
44
47
  switch (ranges[0].kind) {
@@ -52,12 +55,14 @@ function getCommentWithCache(discovered, config, logger, checker, files) {
52
55
  (0, utils_1.assertNever)(ranges[0].kind);
53
56
  }
54
57
  comment.discoveryId = ++commentDiscoveryId;
58
+ comment.inheritedFromParentDeclaration =
59
+ discovered.inheritedFromParentDeclaration;
55
60
  cache.set(ranges[0].pos, comment);
56
61
  commentCache.set(file, cache);
57
62
  return comment.clone();
58
63
  }
59
64
  function getCommentImpl(commentSource, config, logger, moduleComment, checker, files) {
60
- const comment = getCommentWithCache(commentSource, config, logger, checker, files);
65
+ const comment = getCommentWithCache(commentSource, config, logger, config.useTsLinkResolution ? checker : undefined, files);
61
66
  if (comment?.getTag("@import") || comment?.getTag("@license")) {
62
67
  return;
63
68
  }
@@ -78,7 +83,7 @@ function getCommentImpl(commentSource, config, logger, moduleComment, checker, f
78
83
  }
79
84
  return comment;
80
85
  }
81
- function getComment(symbol, kind, config, logger, commentStyle, checker, files) {
86
+ function getComment(symbol, kind, config, logger, checker, files) {
82
87
  const declarations = symbol.declarations || [];
83
88
  if (declarations.length &&
84
89
  declarations.every((d) => jsDocCommentKinds.includes(d.kind))) {
@@ -86,7 +91,7 @@ function getComment(symbol, kind, config, logger, commentStyle, checker, files)
86
91
  }
87
92
  const sf = declarations.find(typescript_1.default.isSourceFile);
88
93
  if (sf) {
89
- return getFileComment(sf, config, logger, commentStyle, checker, files);
94
+ return getFileComment(sf, config, logger, checker, files);
90
95
  }
91
96
  const isModule = declarations.some((decl) => {
92
97
  if (typescript_1.default.isModuleDeclaration(decl) && typescript_1.default.isStringLiteral(decl.name)) {
@@ -94,18 +99,18 @@ function getComment(symbol, kind, config, logger, commentStyle, checker, files)
94
99
  }
95
100
  return false;
96
101
  });
97
- const comment = getCommentImpl((0, discovery_1.discoverComment)(symbol, kind, logger, commentStyle), config, logger, isModule, checker, files);
102
+ const comment = getCommentImpl((0, discovery_1.discoverComment)(symbol, kind, logger, config.commentStyle, checker), config, logger, isModule, checker, files);
98
103
  if (!comment && kind === models_1.ReflectionKind.Property) {
99
- return getConstructorParamPropertyComment(symbol, config, logger, commentStyle, checker, files);
104
+ return getConstructorParamPropertyComment(symbol, config, logger, checker, files);
100
105
  }
101
106
  return comment;
102
107
  }
103
- function getNodeComment(node, moduleComment, config, logger, commentStyle, checker, files) {
104
- return getCommentImpl((0, discovery_1.discoverNodeComment)(node, commentStyle), config, logger, moduleComment, checker, files);
108
+ function getNodeComment(node, moduleComment, config, logger, checker, files) {
109
+ return getCommentImpl((0, discovery_1.discoverNodeComment)(node, config.commentStyle), config, logger, moduleComment, checker, files);
105
110
  }
106
- function getFileComment(file, config, logger, commentStyle, checker, files) {
107
- for (const commentSource of (0, discovery_1.discoverFileComments)(file, commentStyle)) {
108
- const comment = getCommentWithCache(commentSource, config, logger, checker, files);
111
+ function getFileComment(file, config, logger, checker, files) {
112
+ for (const commentSource of (0, discovery_1.discoverFileComments)(file, config.commentStyle)) {
113
+ const comment = getCommentWithCache(commentSource, config, logger, config.useTsLinkResolution ? checker : undefined, files);
109
114
  if (comment?.getTag("@license") || comment?.getTag("@import")) {
110
115
  continue;
111
116
  }
@@ -116,12 +121,12 @@ function getFileComment(file, config, logger, commentStyle, checker, files) {
116
121
  return;
117
122
  }
118
123
  }
119
- function getConstructorParamPropertyComment(symbol, config, logger, commentStyle, checker, files) {
124
+ function getConstructorParamPropertyComment(symbol, config, logger, checker, files) {
120
125
  const decl = symbol.declarations?.find(typescript_1.default.isParameter);
121
126
  if (!decl)
122
127
  return;
123
128
  const ctor = decl.parent;
124
- const comment = getSignatureComment(ctor, config, logger, commentStyle, checker, files);
129
+ const comment = getSignatureComment(ctor, config, logger, checker, files);
125
130
  const paramTag = comment?.getIdentifiedTag(symbol.name, "@param");
126
131
  if (paramTag) {
127
132
  const result = new models_1.Comment(paramTag.content);
@@ -129,8 +134,8 @@ function getConstructorParamPropertyComment(symbol, config, logger, commentStyle
129
134
  return result;
130
135
  }
131
136
  }
132
- function getSignatureComment(declaration, config, logger, commentStyle, checker, files) {
133
- return getCommentImpl((0, discovery_1.discoverSignatureComment)(declaration, commentStyle), config, logger, false, checker, files);
137
+ function getSignatureComment(declaration, config, logger, checker, files) {
138
+ return getCommentImpl((0, discovery_1.discoverSignatureComment)(declaration, checker, config.commentStyle), config, logger, false, checker, files);
134
139
  }
135
140
  function getJsDocComment(declaration, config, logger, checker, files) {
136
141
  const file = declaration.getSourceFile();
@@ -150,7 +155,8 @@ function getJsDocComment(declaration, config, logger, checker, files) {
150
155
  },
151
156
  ],
152
157
  jsDoc: parent,
153
- }, config, logger, checker, files);
158
+ inheritedFromParentDeclaration: false,
159
+ }, config, logger, config.useTsLinkResolution ? checker : undefined, files);
154
160
  // And pull out the tag we actually care about.
155
161
  if (typescript_1.default.isJSDocEnumTag(declaration)) {
156
162
  const result = new models_1.Comment(comment.getTag("@enum")?.content);
@@ -79,6 +79,10 @@ function parseComment(tokens, config, file, logger, files) {
79
79
  postProcessComment(comment, logger.i18n, () => `${(0, paths_1.nicePath)(file.fileName)}:${file.getLineAndCharacterOfPosition(tok2.pos).line + 1}`, (message) => logger.warn(message));
80
80
  return comment;
81
81
  function warningImpl(message, token) {
82
+ if (config.suppressCommentWarningsInDeclarationFiles &&
83
+ file.fileName.endsWith(".d.ts")) {
84
+ return;
85
+ }
82
86
  logger.warn(message, token.pos, file);
83
87
  }
84
88
  }
@@ -98,6 +102,7 @@ function parseCommentString(tokens, config, file, logger, files) {
98
102
  ignoreUnescapedBraces: true,
99
103
  inheritDocTag: true,
100
104
  },
105
+ suppressCommentWarningsInDeclarationFiles: true,
101
106
  };
102
107
  const reentry = new textParser_1.TextParserReentryState();
103
108
  const content = [];
@@ -65,7 +65,7 @@ function textContent(sourcePath, token, i18n, warning, outContent, files, atNewL
65
65
  lastPartEnd = ref.end;
66
66
  data.pos = ref.end;
67
67
  if (!ref.target) {
68
- warning(i18n.relative_path_0_does_not_exist(token.text.slice(ref.pos, ref.end)), {
68
+ warning(i18n.relative_path_0_is_not_a_file_and_will_not_be_copied_to_output(token.text.slice(ref.pos, ref.end)), {
69
69
  kind: lexer_1.TokenSyntaxKind.Text,
70
70
  // ref.pos is relative to the token, but this pos is relative to the file.
71
71
  pos: token.pos + ref.pos,
@@ -134,7 +134,7 @@ function checkMarkdownLink(data, reentry) {
134
134
  if (link.ok) {
135
135
  // Only make a relative-link display part if it's actually a relative link.
136
136
  // Discard protocol:// links, unix style absolute paths, and windows style absolute paths.
137
- if (isRelativeLink(link.str)) {
137
+ if (isRelativePath(link.str)) {
138
138
  return {
139
139
  pos: labelEnd + 2,
140
140
  end: link.pos,
@@ -174,7 +174,7 @@ function checkReference(data) {
174
174
  }
175
175
  const link = MdHelpers.parseLinkDestination(token.text, lookahead, token.text.length);
176
176
  if (link.ok) {
177
- if (isRelativeLink(link.str)) {
177
+ if (isRelativePath(link.str)) {
178
178
  return {
179
179
  pos: lookahead,
180
180
  end: link.pos,
@@ -207,7 +207,7 @@ function checkAttribute(data, attr) {
207
207
  if (parser.state === html_1.ParserState.BeforeAttributeValue &&
208
208
  parser.currentAttributeName === attr) {
209
209
  parser.step();
210
- if (isRelativeLink(parser.currentAttributeValue)) {
210
+ if (isRelativePath(parser.currentAttributeValue)) {
211
211
  data.pos = parser.pos;
212
212
  return {
213
213
  pos: parser.currentAttributeValueStart,
@@ -220,8 +220,14 @@ function checkAttribute(data, attr) {
220
220
  parser.step();
221
221
  }
222
222
  }
223
- function isRelativeLink(link) {
224
- return !/^[a-z]+:\/\/|^\/|^[a-z]:\\|^#/i.test(link);
223
+ function isRelativePath(link) {
224
+ // Lots of edge cases encoded right here!
225
+ // Originally, this attempted to match protocol://, but...
226
+ // `mailto:example@example.com` is not a relative path
227
+ // `C:\foo` is not a relative path
228
+ // `/etc/passwd` is not a relative path
229
+ // `#anchor` is not a relative path
230
+ return !/^[a-z]+:|^\/|^#/i.test(link);
225
231
  }
226
232
  function findLabelEnd(text, pos) {
227
233
  while (pos < text.length) {
@@ -174,19 +174,19 @@ class Context {
174
174
  this._program = program;
175
175
  }
176
176
  getComment(symbol, kind) {
177
- return (0, comments_1.getComment)(symbol, kind, this.converter.config, this.logger, this.converter.commentStyle, this.converter.useTsLinkResolution ? this.checker : undefined, this.project.files);
177
+ return (0, comments_1.getComment)(symbol, kind, this.converter.config, this.logger, this.checker, this.project.files);
178
178
  }
179
179
  getNodeComment(node, moduleComment) {
180
- return (0, comments_1.getNodeComment)(node, moduleComment, this.converter.config, this.logger, this.converter.commentStyle, this.converter.useTsLinkResolution ? this.checker : undefined, this.project.files);
180
+ return (0, comments_1.getNodeComment)(node, moduleComment, this.converter.config, this.logger, this.checker, this.project.files);
181
181
  }
182
182
  getFileComment(node) {
183
- return (0, comments_1.getFileComment)(node, this.converter.config, this.logger, this.converter.commentStyle, this.converter.useTsLinkResolution ? this.checker : undefined, this.project.files);
183
+ return (0, comments_1.getFileComment)(node, this.converter.config, this.logger, this.checker, this.project.files);
184
184
  }
185
185
  getJsDocComment(declaration) {
186
- return (0, comments_1.getJsDocComment)(declaration, this.converter.config, this.logger, this.converter.useTsLinkResolution ? this.checker : undefined, this.project.files);
186
+ return (0, comments_1.getJsDocComment)(declaration, this.converter.config, this.logger, this.checker, this.project.files);
187
187
  }
188
188
  getSignatureComment(declaration) {
189
- return (0, comments_1.getSignatureComment)(declaration, this.converter.config, this.logger, this.converter.commentStyle, this.converter.useTsLinkResolution ? this.checker : undefined, this.project.files);
189
+ return (0, comments_1.getSignatureComment)(declaration, this.converter.config, this.logger, this.checker, this.project.files);
190
190
  }
191
191
  withScope(scope) {
192
192
  const context = new Context(this.converter, this.programs, this.project, scope);
@@ -56,8 +56,6 @@ export declare class Converter extends ChildableComponent<Application, Converter
56
56
  /** @internal */
57
57
  accessor externalSymbolLinkMappings: Record<string, Record<string, string>>;
58
58
  /** @internal */
59
- accessor useTsLinkResolution: boolean;
60
- /** @internal */
61
59
  accessor preserveLinkText: boolean;
62
60
  /** @internal */
63
61
  accessor maxTypeConversionDepth: number;
@@ -73,7 +73,7 @@ const path_1 = require("path");
73
73
  * Compiles source files using TypeScript and converts compiler symbols to reflections.
74
74
  */
75
75
  let Converter = (() => {
76
- var _Converter_externalPattern_accessor_storage, _Converter_excludeExternals_accessor_storage, _Converter_excludeNotDocumented_accessor_storage, _Converter_excludePrivate_accessor_storage, _Converter_excludeProtected_accessor_storage, _Converter_excludeReferences_accessor_storage, _Converter_commentStyle_accessor_storage, _Converter_validation_accessor_storage, _Converter_externalSymbolLinkMappings_accessor_storage, _Converter_useTsLinkResolution_accessor_storage, _Converter_preserveLinkText_accessor_storage, _Converter_maxTypeConversionDepth_accessor_storage;
76
+ var _Converter_externalPattern_accessor_storage, _Converter_excludeExternals_accessor_storage, _Converter_excludeNotDocumented_accessor_storage, _Converter_excludePrivate_accessor_storage, _Converter_excludeProtected_accessor_storage, _Converter_excludeReferences_accessor_storage, _Converter_commentStyle_accessor_storage, _Converter_validation_accessor_storage, _Converter_externalSymbolLinkMappings_accessor_storage, _Converter_preserveLinkText_accessor_storage, _Converter_maxTypeConversionDepth_accessor_storage;
77
77
  let _classDecorators = [(0, component_1.Component)({
78
78
  name: "converter",
79
79
  internal: true,
@@ -110,9 +110,6 @@ let Converter = (() => {
110
110
  let _externalSymbolLinkMappings_decorators;
111
111
  let _externalSymbolLinkMappings_initializers = [];
112
112
  let _externalSymbolLinkMappings_extraInitializers = [];
113
- let _useTsLinkResolution_decorators;
114
- let _useTsLinkResolution_initializers = [];
115
- let _useTsLinkResolution_extraInitializers = [];
116
113
  let _preserveLinkText_decorators;
117
114
  let _preserveLinkText_initializers = [];
118
115
  let _preserveLinkText_extraInitializers = [];
@@ -148,9 +145,6 @@ let Converter = (() => {
148
145
  get externalSymbolLinkMappings() { return __classPrivateFieldGet(this, _Converter_externalSymbolLinkMappings_accessor_storage, "f"); }
149
146
  set externalSymbolLinkMappings(value) { __classPrivateFieldSet(this, _Converter_externalSymbolLinkMappings_accessor_storage, value, "f"); }
150
147
  /** @internal */
151
- get useTsLinkResolution() { return __classPrivateFieldGet(this, _Converter_useTsLinkResolution_accessor_storage, "f"); }
152
- set useTsLinkResolution(value) { __classPrivateFieldSet(this, _Converter_useTsLinkResolution_accessor_storage, value, "f"); }
153
- /** @internal */
154
148
  get preserveLinkText() { return __classPrivateFieldGet(this, _Converter_preserveLinkText_accessor_storage, "f"); }
155
149
  set preserveLinkText(value) { __classPrivateFieldSet(this, _Converter_preserveLinkText_accessor_storage, value, "f"); }
156
150
  /** @internal */
@@ -171,8 +165,7 @@ let Converter = (() => {
171
165
  _Converter_commentStyle_accessor_storage.set(this, (__runInitializers(this, _excludeReferences_extraInitializers), __runInitializers(this, _commentStyle_initializers, void 0)));
172
166
  _Converter_validation_accessor_storage.set(this, (__runInitializers(this, _commentStyle_extraInitializers), __runInitializers(this, _validation_initializers, void 0)));
173
167
  _Converter_externalSymbolLinkMappings_accessor_storage.set(this, (__runInitializers(this, _validation_extraInitializers), __runInitializers(this, _externalSymbolLinkMappings_initializers, void 0)));
174
- _Converter_useTsLinkResolution_accessor_storage.set(this, (__runInitializers(this, _externalSymbolLinkMappings_extraInitializers), __runInitializers(this, _useTsLinkResolution_initializers, void 0)));
175
- _Converter_preserveLinkText_accessor_storage.set(this, (__runInitializers(this, _useTsLinkResolution_extraInitializers), __runInitializers(this, _preserveLinkText_initializers, void 0)));
168
+ _Converter_preserveLinkText_accessor_storage.set(this, (__runInitializers(this, _externalSymbolLinkMappings_extraInitializers), __runInitializers(this, _preserveLinkText_initializers, void 0)));
176
169
  _Converter_maxTypeConversionDepth_accessor_storage.set(this, (__runInitializers(this, _preserveLinkText_extraInitializers), __runInitializers(this, _maxTypeConversionDepth_initializers, void 0)));
177
170
  this._config = __runInitializers(this, _maxTypeConversionDepth_extraInitializers);
178
171
  this._externalSymbolResolvers = [];
@@ -468,6 +461,9 @@ let Converter = (() => {
468
461
  inlineTags: new Set(this.application.options.getValue("inlineTags")),
469
462
  modifierTags: new Set(this.application.options.getValue("modifierTags")),
470
463
  jsDocCompatibility: this.application.options.getValue("jsDocCompatibility"),
464
+ suppressCommentWarningsInDeclarationFiles: this.application.options.getValue("suppressCommentWarningsInDeclarationFiles"),
465
+ useTsLinkResolution: this.application.options.getValue("useTsLinkResolution"),
466
+ commentStyle: this.application.options.getValue("commentStyle"),
471
467
  };
472
468
  // Can't be included in options because the TSDoc parser blows up if we do.
473
469
  // TypeDoc supports it as one, so it should always be included here.
@@ -484,7 +480,6 @@ let Converter = (() => {
484
480
  _Converter_commentStyle_accessor_storage = new WeakMap();
485
481
  _Converter_validation_accessor_storage = new WeakMap();
486
482
  _Converter_externalSymbolLinkMappings_accessor_storage = new WeakMap();
487
- _Converter_useTsLinkResolution_accessor_storage = new WeakMap();
488
483
  _Converter_preserveLinkText_accessor_storage = new WeakMap();
489
484
  _Converter_maxTypeConversionDepth_accessor_storage = new WeakMap();
490
485
  __setFunctionName(_classThis, "Converter");
@@ -499,7 +494,6 @@ let Converter = (() => {
499
494
  _commentStyle_decorators = [(0, utils_1.Option)("commentStyle")];
500
495
  _validation_decorators = [(0, utils_1.Option)("validation")];
501
496
  _externalSymbolLinkMappings_decorators = [(0, utils_1.Option)("externalSymbolLinkMappings")];
502
- _useTsLinkResolution_decorators = [(0, utils_1.Option)("useTsLinkResolution")];
503
497
  _preserveLinkText_decorators = [(0, utils_1.Option)("preserveLinkText")];
504
498
  _maxTypeConversionDepth_decorators = [(0, utils_1.Option)("maxTypeConversionDepth")];
505
499
  __esDecorate(_classThis, null, _externalPattern_decorators, { kind: "accessor", name: "externalPattern", static: false, private: false, access: { has: obj => "externalPattern" in obj, get: obj => obj.externalPattern, set: (obj, value) => { obj.externalPattern = value; } }, metadata: _metadata }, _externalPattern_initializers, _externalPattern_extraInitializers);
@@ -511,7 +505,6 @@ let Converter = (() => {
511
505
  __esDecorate(_classThis, null, _commentStyle_decorators, { kind: "accessor", name: "commentStyle", static: false, private: false, access: { has: obj => "commentStyle" in obj, get: obj => obj.commentStyle, set: (obj, value) => { obj.commentStyle = value; } }, metadata: _metadata }, _commentStyle_initializers, _commentStyle_extraInitializers);
512
506
  __esDecorate(_classThis, null, _validation_decorators, { kind: "accessor", name: "validation", static: false, private: false, access: { has: obj => "validation" in obj, get: obj => obj.validation, set: (obj, value) => { obj.validation = value; } }, metadata: _metadata }, _validation_initializers, _validation_extraInitializers);
513
507
  __esDecorate(_classThis, null, _externalSymbolLinkMappings_decorators, { kind: "accessor", name: "externalSymbolLinkMappings", static: false, private: false, access: { has: obj => "externalSymbolLinkMappings" in obj, get: obj => obj.externalSymbolLinkMappings, set: (obj, value) => { obj.externalSymbolLinkMappings = value; } }, metadata: _metadata }, _externalSymbolLinkMappings_initializers, _externalSymbolLinkMappings_extraInitializers);
514
- __esDecorate(_classThis, null, _useTsLinkResolution_decorators, { kind: "accessor", name: "useTsLinkResolution", static: false, private: false, access: { has: obj => "useTsLinkResolution" in obj, get: obj => obj.useTsLinkResolution, set: (obj, value) => { obj.useTsLinkResolution = value; } }, metadata: _metadata }, _useTsLinkResolution_initializers, _useTsLinkResolution_extraInitializers);
515
508
  __esDecorate(_classThis, null, _preserveLinkText_decorators, { kind: "accessor", name: "preserveLinkText", static: false, private: false, access: { has: obj => "preserveLinkText" in obj, get: obj => obj.preserveLinkText, set: (obj, value) => { obj.preserveLinkText = value; } }, metadata: _metadata }, _preserveLinkText_initializers, _preserveLinkText_extraInitializers);
516
509
  __esDecorate(_classThis, null, _maxTypeConversionDepth_decorators, { kind: "accessor", name: "maxTypeConversionDepth", static: false, private: false, access: { has: obj => "maxTypeConversionDepth" in obj, get: obj => obj.maxTypeConversionDepth, set: (obj, value) => { obj.maxTypeConversionDepth = value; } }, metadata: _metadata }, _maxTypeConversionDepth_initializers, _maxTypeConversionDepth_extraInitializers);
517
510
  __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
@@ -596,7 +596,7 @@ let CommentPlugin = (() => {
596
596
  const paramTags = comment.blockTags.filter((tag) => tag.tag === "@param");
597
597
  (0, utils_1.removeIf)(paramTags, (tag) => params.some((param) => param.name === tag.name));
598
598
  moveNestedParamTags(/* in-out */ paramTags, params, comment.sourcePath);
599
- if (paramTags.length) {
599
+ if (!comment.inheritedFromParentDeclaration) {
600
600
  for (const tag of paramTags) {
601
601
  this.application.logger.warn(this.application.i18n.signature_0_has_unused_param_with_name_1(signature.getFriendlyFullName(), tag.name ?? "(missing)"));
602
602
  }
@@ -33,7 +33,7 @@ module.exports = (0, translatable_1.buildIncompleteTranslation)({
33
33
  comments_for_0_are_declared_at_1: "{0} のコメントは次の場所で宣言されています:\n{1}",
34
34
  multiple_type_parameters_on_template_tag_unsupported: "TypeDoc は、コメント付きの単一の @template タグで定義された複数の型パラメータをサポートしていません。",
35
35
  failed_to_find_jsdoc_tag_for_name_0: "コメントを解析した後、{0} の JSDoc タグが見つかりませんでした。バグレポートを提出してください。",
36
- relative_path_0_does_not_exist: "相対パス {0} は存在しません",
36
+ // relative_path_0_is_not_a_file_and_will_not_be_copied_to_output
37
37
  inline_inheritdoc_should_not_appear_in_block_tag_in_comment_at_0: "インライン @inheritDoc タグはブロック タグ内に出現しないでください。{0} のコメントでは処理されません。",
38
38
  at_most_one_remarks_tag_expected_in_comment_at_0: "コメントには最大 1 つの @remarks タグが必要です。{0} のコメントの最初のタグ以外はすべて無視されます。",
39
39
  at_most_one_returns_tag_expected_in_comment_at_0: "コメントには最大 1 つの @returns タグが必要です。{0} のコメントの最初のタグ以外はすべて無視されます。",
@@ -93,7 +93,7 @@ module.exports = (0, translatable_1.buildIncompleteTranslation)({
93
93
  entry_point_0_did_not_match_any_packages: "エントリ ポイント glob {0} は、package.json を含むディレクトリと一致しませんでした。",
94
94
  file_0_not_an_object: "ファイル {0} はオブジェクトではありません",
95
95
  serialized_project_referenced_0_not_part_of_project: "シリアル化されたプロジェクトは、プロジェクトの一部ではないリフレクション {0} を参照しました",
96
- saved_relative_path_0_resolved_from_1_does_not_exist: "シリアル化されたプロジェクトは {0} を参照していますが、{1} に関連して存在しません",
96
+ // saved_relative_path_0_resolved_from_1_is_not_a_file
97
97
  circular_reference_extends_0: '{0} の "extends" フィールドで循環参照が検出されました',
98
98
  failed_resolve_0_to_file_in_1: "{0} を {1} 内のファイルに解決できませんでした",
99
99
  option_0_can_only_be_specified_by_config_file: "'{0}' オプションは設定ファイル経由でのみ指定できます",