@cjser/es-joy__jsdoccomment 0.96.0-cjser.2 → 0.98.0-cjser.2

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.
package/CHANGES.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGES for `@es-joy/jsdoccomment`
2
2
 
3
+ ## 0.98.0
4
+
5
+ - chore: update typescript-eslint/types, comment-parser, jsdoc-type-pratt-parser, devDeps
6
+
7
+ ## 0.97.0
8
+
9
+ - fix: accept any AST node in the public comment-finding helpers regardless of `@typescript-eslint/types` version
10
+
3
11
  ## 0.96.0
4
12
 
5
13
  - feat: update jsdoc-type-pratt-parser and devDeps.
package/dist/index.d.ts CHANGED
@@ -82,9 +82,9 @@ type CommentParserToESTreeOptions = {
82
82
  * By default, empty lines are
83
83
  * compacted; set to 'preserve' to preserve empty comment lines.
84
84
  */
85
- spacing?: 'compact' | 'preserve';
86
- throwOnTypeParsingErrors?: boolean;
87
- jsdocTypePrattParserArgs?: JtppOptions;
85
+ spacing?: 'preserve' | 'compact' | undefined;
86
+ throwOnTypeParsingErrors?: boolean | undefined;
87
+ jsdocTypePrattParserArgs?: JtppOptions | undefined;
88
88
  };
89
89
  /**
90
90
  * @typedef {{
@@ -116,10 +116,10 @@ declare function commentParserToESTree(
116
116
  ): JsdocBlock;
117
117
  declare namespace jsdocVisitorKeys {
118
118
  let JsdocBlock: string[];
119
- let JsdocDescriptionLine: any[];
120
- let JsdocTypeLine: any[];
119
+ let JsdocDescriptionLine: never[];
120
+ let JsdocTypeLine: never[];
121
121
  let JsdocTag: string[];
122
- let JsdocInlineTag: any[];
122
+ let JsdocInlineTag: never[];
123
123
  }
124
124
 
125
125
  /**
@@ -168,6 +168,23 @@ type Token =
168
168
  value: string;
169
169
  };
170
170
  type ESLintOrTSNode = eslint.Rule.Node | _typescript_eslint_types.TSESTree.Node;
171
+ /**
172
+ * The type accepted in node parameter positions of the public comment-finding
173
+ * helpers. It is deliberately looser than {@link ESLintOrTSNode}: callers pass
174
+ * nodes typed against their own copy of `@typescript-eslint/types`, and when
175
+ * that copy differs from the one resolved here the two `TSESTree` unions are
176
+ * nominally distinct and, being large and recursive, can exceed the
177
+ * type-checker's comparison depth. Requiring only `type` lets any AST node
178
+ * through while the helpers narrow internally; return types keep the precise
179
+ * {@link ESLintOrTSNode}.
180
+ *
181
+ * `ESLintOrTSNode` is deliberately *not* part of this union: including it makes
182
+ * the checker relate arguments against the full recursive `TSESTree.Node` union
183
+ * anyway, which is what overflows.
184
+ */
185
+ type ESLintOrTSNodeInput = {
186
+ type: string;
187
+ };
171
188
  type int = number;
172
189
  type DecoratedNode =
173
190
  | ESLintOrTSNode
@@ -194,14 +211,14 @@ type Settings = {
194
211
  * Reduces the provided node to the appropriate node for evaluating
195
212
  * JSDoc comment status.
196
213
  *
197
- * @param {ESLintOrTSNode} node An AST node.
214
+ * @param {ESLintOrTSNodeInput} nodeInput An AST node.
198
215
  * @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode.
199
216
  * @param {Settings} [settings]
200
217
  * @returns {ESLintOrTSNode} The AST node that
201
218
  * can be evaluated for appropriate JSDoc comments.
202
219
  */
203
220
  declare function getReducedASTNode(
204
- node: ESLintOrTSNode,
221
+ nodeInput: ESLintOrTSNodeInput,
205
222
  sourceCode: eslint.SourceCode,
206
223
  settings?: Settings,
207
224
  ): ESLintOrTSNode;
@@ -209,7 +226,7 @@ declare function getReducedASTNode(
209
226
  * Retrieves the JSDoc comment for a given node.
210
227
  *
211
228
  * @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode
212
- * @param {ESLintOrTSNode} node The AST node to get
229
+ * @param {ESLintOrTSNodeInput} node The AST node to get
213
230
  * the comment for.
214
231
  * @param {Settings} settings The settings in context
215
232
  * @param {{checkOverloads?: boolean}} [opts]
@@ -220,7 +237,7 @@ declare function getReducedASTNode(
220
237
  */
221
238
  declare function getJSDocComment(
222
239
  sourceCode: eslint.SourceCode,
223
- node: ESLintOrTSNode,
240
+ node: ESLintOrTSNodeInput,
224
241
  settings: Settings,
225
242
  opts?: {
226
243
  checkOverloads?: boolean;
@@ -230,7 +247,7 @@ declare function getJSDocComment(
230
247
  * Retrieves the comment preceding a given node.
231
248
  *
232
249
  * @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode
233
- * @param {ESLintOrTSNode} node The AST node to get
250
+ * @param {ESLintOrTSNodeInput} node The AST node to get
234
251
  * the comment for.
235
252
  * @param {{maxLines: int, minLines: int, [name: string]: any}} settings The
236
253
  * settings in context
@@ -241,7 +258,7 @@ declare function getJSDocComment(
241
258
  */
242
259
  declare function getNonJsdocComment(
243
260
  sourceCode: eslint.SourceCode,
244
- node: ESLintOrTSNode,
261
+ node: ESLintOrTSNodeInput,
245
262
  settings: {
246
263
  maxLines: int;
247
264
  minLines: int;
@@ -263,7 +280,7 @@ declare function getDecorator(node: DecoratedNode): _typescript_eslint_types.TSE
263
280
  /**
264
281
  * Checks for the presence of a JSDoc comment for the given node and returns it.
265
282
  *
266
- * @param {ESLintOrTSNode} astNode The AST node to get
283
+ * @param {ESLintOrTSNodeInput} astNode The AST node to get
267
284
  * the comment for.
268
285
  * @param {import('eslint').SourceCode} sourceCode
269
286
  * @param {{maxLines: int, minLines: int, [name: string]: any}} settings
@@ -272,7 +289,7 @@ declare function getDecorator(node: DecoratedNode): _typescript_eslint_types.TSE
272
289
  * for the given node or null if not found.
273
290
  */
274
291
  declare function findJSDocComment(
275
- astNode: ESLintOrTSNode,
292
+ astNode: ESLintOrTSNodeInput,
276
293
  sourceCode: eslint.SourceCode,
277
294
  settings: {
278
295
  maxLines: int;
@@ -290,12 +307,12 @@ declare function findJSDocComment(
290
307
  * This method is experimental.
291
308
  *
292
309
  * @param {import('eslint').SourceCode} sourceCode
293
- * @param {ESLintOrTSNode} astNode The AST node to get
310
+ * @param {ESLintOrTSNodeInput} astNodeInput The AST node to get
294
311
  * the comment for.
295
312
  * @returns {Token|null} The comment token containing the comment
296
313
  * for the given node or null if not found.
297
314
  */
298
- declare function getFollowingComment(sourceCode: eslint.SourceCode, astNode: ESLintOrTSNode): Token | null;
315
+ declare function getFollowingComment(sourceCode: eslint.SourceCode, astNodeInput: ESLintOrTSNodeInput): Token | null;
299
316
 
300
317
  declare function hasSeeWithLink(spec: comment_parser.Spec): boolean;
301
318
  declare const defaultNoTypes: string[];
@@ -321,8 +338,8 @@ declare function getTokenizers({
321
338
  noTypes,
322
339
  noNames,
323
340
  }?: {
324
- noTypes?: string[];
325
- noNames?: string[];
341
+ noTypes?: string[] | undefined;
342
+ noNames?: string[] | undefined;
326
343
  }): CommentParserTokenizer[];
327
344
  /**
328
345
  * Accepts a comment token or complete comment string and converts it into
@@ -408,6 +425,7 @@ export type {
408
425
  CommentParserTokenizer,
409
426
  DecoratedNode,
410
427
  ESLintOrTSNode,
428
+ ESLintOrTSNodeInput,
411
429
  ESTreeToStringOptions,
412
430
  InlineTag,
413
431
  Integer,
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // packages/@cjser/es-joy__jsdoccomment.tmp-26-1788540365480/src/index.js
30
+ // packages/@cjser/es-joy__jsdoccomment.tmp-26-1789749139393/src/index.js
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
33
  commentHandler: () => commentHandler,
@@ -52,11 +52,11 @@ module.exports = __toCommonJS(index_exports);
52
52
  var import_jsdoc_type_pratt_parser4 = require("@cjser/jsdoc-type-pratt-parser");
53
53
  __reExport(index_exports, require("@cjser/jsdoc-type-pratt-parser"), module.exports);
54
54
 
55
- // packages/@cjser/es-joy__jsdoccomment.tmp-26-1788540365480/src/commentHandler.js
55
+ // packages/@cjser/es-joy__jsdoccomment.tmp-26-1789749139393/src/commentHandler.js
56
56
  var import_esquery = __toESM(require("esquery"), 1);
57
57
  var import_jsdoc_type_pratt_parser2 = require("@cjser/jsdoc-type-pratt-parser");
58
58
 
59
- // packages/@cjser/es-joy__jsdoccomment.tmp-26-1788540365480/src/commentParserToESTree.js
59
+ // packages/@cjser/es-joy__jsdoccomment.tmp-26-1789749139393/src/commentParserToESTree.js
60
60
  var import_jsdoc_type_pratt_parser = require("@cjser/jsdoc-type-pratt-parser");
61
61
  var stripEncapsulatingBrackets = (container, isArr) => {
62
62
  if (isArr) {
@@ -230,7 +230,9 @@ var commentParserToESTree = (jsdoc, mode = "typescript", {
230
230
  i++;
231
231
  }
232
232
  }
233
- const tagInlineTags = tag ? (
233
+ const tagInlineTags = (
234
+ // Assuming the tags from `source` are in the same order as `jsdoc.tags`
235
+ // we can use the `tags` length as index into the parser result tags.
234
236
  /**
235
237
  * @type {import('comment-parser').Spec & {
236
238
  * inlineTags: JsdocInlineTagNoType[]
@@ -239,7 +241,7 @@ var commentParserToESTree = (jsdoc, mode = "typescript", {
239
241
  jsdoc.tags[tags.length].inlineTags.map(
240
242
  (t) => inlineTagToAST(t)
241
243
  )
242
- ) : [];
244
+ );
243
245
  const tagObj = {
244
246
  ...tkns,
245
247
  initial: endLine ? init : "",
@@ -340,7 +342,7 @@ var jsdocVisitorKeys = {
340
342
  JsdocInlineTag: []
341
343
  };
342
344
 
343
- // packages/@cjser/es-joy__jsdoccomment.tmp-26-1788540365480/src/commentHandler.js
345
+ // packages/@cjser/es-joy__jsdoccomment.tmp-26-1789749139393/src/commentHandler.js
344
346
  var commentHandler = (settings, commentParserToESTreeOptions) => {
345
347
  return (commentSelector, jsdoc) => {
346
348
  const { mode } = settings;
@@ -369,10 +371,10 @@ var commentHandler = (settings, commentParserToESTreeOptions) => {
369
371
  };
370
372
  };
371
373
 
372
- // packages/@cjser/es-joy__jsdoccomment.tmp-26-1788540365480/src/estreeToString.js
374
+ // packages/@cjser/es-joy__jsdoccomment.tmp-26-1789749139393/src/estreeToString.js
373
375
  var import_jsdoc_type_pratt_parser3 = require("@cjser/jsdoc-type-pratt-parser");
374
376
 
375
- // packages/@cjser/es-joy__jsdoccomment.tmp-26-1788540365480/src/inlineTagEscapes.js
377
+ // packages/@cjser/es-joy__jsdoccomment.tmp-26-1789749139393/src/inlineTagEscapes.js
376
378
  function getLabelDelimiter(format) {
377
379
  return format === "prefix" ? "]" : "}";
378
380
  }
@@ -416,7 +418,7 @@ function encodeInlineTagText(text, format) {
416
418
  return encoded;
417
419
  }
418
420
 
419
- // packages/@cjser/es-joy__jsdoccomment.tmp-26-1788540365480/src/estreeToString.js
421
+ // packages/@cjser/es-joy__jsdoccomment.tmp-26-1789749139393/src/estreeToString.js
420
422
  var stringifiers = {
421
423
  /* eslint-enable jsdoc/reject-function-type -- Different functions */
422
424
  JsdocBlock,
@@ -572,7 +574,7 @@ function JsdocTag(node, opts) {
572
574
  return result;
573
575
  }
574
576
 
575
- // packages/@cjser/es-joy__jsdoccomment.tmp-26-1788540365480/src/jsdoccomment.js
577
+ // packages/@cjser/es-joy__jsdoccomment.tmp-26-1789749139393/src/jsdoccomment.js
576
578
  var isCommentToken = (token) => {
577
579
  return ["Line", "Block", "Shebang"].includes(token.type);
578
580
  };
@@ -682,12 +684,13 @@ var allowableCommentNode = /* @__PURE__ */ new Set([
682
684
  "ExportDefaultDeclaration",
683
685
  "ReturnStatement"
684
686
  ]);
685
- var getReducedASTNode = function(node, sourceCode, settings) {
686
- let { parent } = node;
687
- switch (
687
+ var getReducedASTNode = function(nodeInput, sourceCode, settings) {
688
+ const node = (
688
689
  /** @type {ESLintOrTSNode} */
689
- node.type
690
- ) {
690
+ nodeInput
691
+ );
692
+ let { parent } = node;
693
+ switch (node.type) {
691
694
  case "TSFunctionType":
692
695
  return getTSFunctionComment(node);
693
696
  case "TSInterfaceDeclaration":
@@ -750,7 +753,10 @@ var getReducedASTNode = function(node, sourceCode, settings) {
750
753
  var findJSDocComment = (astNode, sourceCode, settings, opts = {}) => {
751
754
  const { nonJSDoc } = opts;
752
755
  const { minLines, maxLines } = settings;
753
- let currentNode = astNode;
756
+ let currentNode = (
757
+ /** @type {ESLintOrTSNode} */
758
+ astNode
759
+ );
754
760
  let tokenBefore = null;
755
761
  let parenthesisToken = null;
756
762
  while (currentNode) {
@@ -936,7 +942,11 @@ var compareLocEndToStart = (nodeA, nodeB) => {
936
942
  var _a, _b;
937
943
  return (((_a = nodeA.loc) == null ? void 0 : _a.end.line) ?? 0) === (((_b = nodeB.loc) == null ? void 0 : _b.start.line) ?? 0);
938
944
  };
939
- var getFollowingComment = function(sourceCode, astNode) {
945
+ var getFollowingComment = function(sourceCode, astNodeInput) {
946
+ const astNode = (
947
+ /** @type {ESLintOrTSNode} */
948
+ astNodeInput
949
+ );
940
950
  const getTokensAfterIgnoringSemis = (node) => {
941
951
  let tokenAfter2 = sourceCode.getTokenAfter(
942
952
  /** @type {import('eslint').Rule.Node} */
@@ -978,10 +988,10 @@ var getFollowingComment = function(sourceCode, astNode) {
978
988
  return tokenAfter;
979
989
  };
980
990
 
981
- // packages/@cjser/es-joy__jsdoccomment.tmp-26-1788540365480/src/parseComment.js
991
+ // packages/@cjser/es-joy__jsdoccomment.tmp-26-1789749139393/src/parseComment.js
982
992
  var import_comment_parser = require("comment-parser");
983
993
 
984
- // packages/@cjser/es-joy__jsdoccomment.tmp-26-1788540365480/src/parseInlineTags.js
994
+ // packages/@cjser/es-joy__jsdoccomment.tmp-26-1789749139393/src/parseInlineTags.js
985
995
  function determineFormat(match) {
986
996
  const { separator, text } = match.groups;
987
997
  const [, textEnd] = match.indices.groups.text;
@@ -1020,7 +1030,10 @@ function parseDescription(description) {
1020
1030
  mtch
1021
1031
  );
1022
1032
  const { tag, namepathOrURL, text } = match.groups;
1023
- const [start, end] = match.indices[0];
1033
+ const [start, end] = (
1034
+ /** @type {[number, number]} */
1035
+ match.indices[0]
1036
+ );
1024
1037
  const format = determineFormat(match);
1025
1038
  const decodedText = decodeInlineTagText(text, format);
1026
1039
  result.push({
@@ -1055,7 +1068,7 @@ function parseInlineTags(block) {
1055
1068
  );
1056
1069
  }
1057
1070
 
1058
- // packages/@cjser/es-joy__jsdoccomment.tmp-26-1788540365480/src/parseComment.js
1071
+ // packages/@cjser/es-joy__jsdoccomment.tmp-26-1789749139393/src/parseComment.js
1059
1072
  var {
1060
1073
  name: nameTokenizer,
1061
1074
  tag: tagTokenizer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cjser/es-joy__jsdoccomment",
3
- "version": "0.96.0-cjser.2",
3
+ "version": "0.98.0-cjser.2",
4
4
  "author": "Brett Zamir <brettz9@yahoo.com>",
5
5
  "contributors": [],
6
6
  "description": "Maintained replacement for ESLint's deprecated SourceCode#getJSDocComment along with other jsdoc utilities",
@@ -45,32 +45,32 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@types/estree": "^1.0.9",
48
- "@typescript-eslint/types": "^8.67.0",
49
- "comment-parser": "1.4.8",
48
+ "@typescript-eslint/types": "^8.70.0",
49
+ "comment-parser": "1.4.9",
50
50
  "esquery": "^1.7.0",
51
- "@cjser/jsdoc-type-pratt-parser": "9.2.1-cjser.2"
51
+ "@cjser/jsdoc-type-pratt-parser": "9.2.2-cjser.2"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@arethetypeswrong/cli": "^0.18.5",
55
- "@brettz9/node-static": "^0.1.1",
55
+ "@node-static/node-static": "^0.10.0",
56
56
  "@types/esquery": "^1.5.4",
57
57
  "@types/estraverse": "^5.1.7",
58
- "@typescript-eslint/visitor-keys": "^8.67.0",
58
+ "@typescript-eslint/visitor-keys": "^8.70.0",
59
59
  "@typhonjs-build-test/esm-d-ts": "0.4.0",
60
60
  "@typhonjs-typedoc/typedoc-pkg": "^0.4.2",
61
- "@vitest/coverage-v8": "^4.1.11",
62
- "@vitest/ui": "^4.1.11",
63
- "@webcoder49/code-input": "^2.8.3",
64
- "eslint": "^10.9.0",
65
- "eslint-config-ash-nazg": "42.6.0",
66
- "eslint-plugin-jsdoc": "^64.2.1",
61
+ "@vitest/coverage-v8": "^5.0.1",
62
+ "@vitest/ui": "^5.0.1",
63
+ "@webcoder49/code-input": "^2.8.4",
64
+ "eslint": "^10.10.0",
65
+ "eslint-config-ash-nazg": "43.1.10",
66
+ "eslint-plugin-jsdoc": "^64.5.2",
67
67
  "espree": "^11.2.0",
68
68
  "estraverse": "^5.3.0",
69
69
  "prismjs": "^1.30.0",
70
70
  "typedoc": "^0.28.20",
71
- "typescript": "^5.9.3",
72
- "typescript-eslint": "^8.67.0",
73
- "vitest": "^4.1.11"
71
+ "typescript": "6.0.3",
72
+ "typescript-eslint": "^8.70.0",
73
+ "vitest": "^5.0.1"
74
74
  },
75
75
  "files": [
76
76
  "/dist",
@@ -92,15 +92,16 @@
92
92
  "test-ui": "vitest --ui --coverage",
93
93
  "test-cov": "vitest --coverage",
94
94
  "tsc": "tsc",
95
+ "tsc:ts7": "npx -y -p typescript@^7 -c \"tsc\"",
95
96
  "types": "esm-d-ts gen ./src/index.js --output ./dist/index.d.ts"
96
97
  },
97
98
  "main": "./dist-cjser/index.cjs",
98
99
  "cjser": {
99
- "sourceVersion": "0.96.0",
100
+ "sourceVersion": "0.98.0",
100
101
  "cjserVersion": 2,
101
102
  "original": {
102
103
  "name": "@es-joy/jsdoccomment",
103
- "version": "0.96.0",
104
+ "version": "0.98.0",
104
105
  "exports": {
105
106
  ".": {
106
107
  "types": "./dist/index.d.ts",
@@ -113,10 +114,10 @@
113
114
  },
114
115
  "dependencies": {
115
116
  "@types/estree": "^1.0.9",
116
- "@typescript-eslint/types": "^8.67.0",
117
- "comment-parser": "1.4.8",
117
+ "@typescript-eslint/types": "^8.70.0",
118
+ "comment-parser": "1.4.9",
118
119
  "esquery": "^1.7.0",
119
- "jsdoc-type-pratt-parser": "~9.2.0"
120
+ "jsdoc-type-pratt-parser": "~9.2.2"
120
121
  },
121
122
  "files": [
122
123
  "/dist",
@@ -137,6 +138,7 @@
137
138
  "test-ui": "vitest --ui --coverage",
138
139
  "test-cov": "vitest --coverage",
139
140
  "tsc": "tsc",
141
+ "tsc:ts7": "npx -y -p typescript@^7 -c \"tsc\"",
140
142
  "types": "esm-d-ts gen ./src/index.js --output ./dist/index.d.ts"
141
143
  }
142
144
  }
@@ -359,11 +359,9 @@ const commentParserToESTree = (jsdoc, mode = 'typescript', {
359
359
  /**
360
360
  * @type {JsdocInlineTag[]}
361
361
  */
362
- const tagInlineTags = tag
363
- // Assuming the tags from `source` are in the same order as `jsdoc.tags`
364
- // we can use the `tags` length as index into the parser result tags.
365
- // eslint-disable-next-line @stylistic/operator-linebreak -- Required
366
- ?
362
+ const tagInlineTags =
363
+ // Assuming the tags from `source` are in the same order as `jsdoc.tags`
364
+ // we can use the `tags` length as index into the parser result tags.
367
365
  /**
368
366
  * @type {import('comment-parser').Spec & {
369
367
  * inlineTags: JsdocInlineTagNoType[]
@@ -372,8 +370,7 @@ const commentParserToESTree = (jsdoc, mode = 'typescript', {
372
370
  jsdoc.tags[tags.length]
373
371
  ).inlineTags.map(
374
372
  (t) => inlineTagToAST(t)
375
- )
376
- : [];
373
+ );
377
374
 
378
375
  /** @type {JsdocTag} */
379
376
  const tagObj = {
@@ -18,6 +18,22 @@
18
18
  * import('@typescript-eslint/types').TSESTree.Node} ESLintOrTSNode
19
19
  */
20
20
 
21
+ /**
22
+ * The type accepted in node parameter positions of the public comment-finding
23
+ * helpers. It is deliberately looser than {@link ESLintOrTSNode}: callers pass
24
+ * nodes typed against their own copy of `@typescript-eslint/types`, and when
25
+ * that copy differs from the one resolved here the two `TSESTree` unions are
26
+ * nominally distinct and, being large and recursive, can exceed the
27
+ * type-checker's comparison depth. Requiring only `type` lets any AST node
28
+ * through while the helpers narrow internally; return types keep the precise
29
+ * {@link ESLintOrTSNode}.
30
+ *
31
+ * `ESLintOrTSNode` is deliberately *not* part of this union: including it makes
32
+ * the checker relate arguments against the full recursive `TSESTree.Node` union
33
+ * anyway, which is what overflows.
34
+ * @typedef {{type: string}} ESLintOrTSNodeInput
35
+ */
36
+
21
37
  /**
22
38
  * @typedef {number} int
23
39
  */
@@ -202,15 +218,16 @@ const allowableCommentNode = new Set([
202
218
  * Reduces the provided node to the appropriate node for evaluating
203
219
  * JSDoc comment status.
204
220
  *
205
- * @param {ESLintOrTSNode} node An AST node.
221
+ * @param {ESLintOrTSNodeInput} nodeInput An AST node.
206
222
  * @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode.
207
223
  * @param {Settings} [settings]
208
224
  * @returns {ESLintOrTSNode} The AST node that
209
225
  * can be evaluated for appropriate JSDoc comments.
210
226
  */
211
- const getReducedASTNode = function (node, sourceCode, settings) {
227
+ const getReducedASTNode = function (nodeInput, sourceCode, settings) {
228
+ const node = /** @type {ESLintOrTSNode} */ (nodeInput);
212
229
  let {parent} = node;
213
- switch (/** @type {ESLintOrTSNode} */ (node).type) {
230
+ switch (node.type) {
214
231
  case 'TSFunctionType':
215
232
  return getTSFunctionComment(node);
216
233
  case 'TSInterfaceDeclaration':
@@ -296,7 +313,7 @@ const getReducedASTNode = function (node, sourceCode, settings) {
296
313
  /**
297
314
  * Checks for the presence of a JSDoc comment for the given node and returns it.
298
315
  *
299
- * @param {ESLintOrTSNode} astNode The AST node to get
316
+ * @param {ESLintOrTSNodeInput} astNode The AST node to get
300
317
  * the comment for.
301
318
  * @param {import('eslint').SourceCode} sourceCode
302
319
  * @param {{maxLines: int, minLines: int, [name: string]: any}} settings
@@ -309,7 +326,7 @@ const findJSDocComment = (astNode, sourceCode, settings, opts = {}) => {
309
326
  const {minLines, maxLines} = settings;
310
327
 
311
328
  /** @type {ESLintOrTSNode|import('estree').Comment} */
312
- let currentNode = astNode;
329
+ let currentNode = /** @type {ESLintOrTSNode} */ (astNode);
313
330
  let tokenBefore = null;
314
331
  let parenthesisToken = null;
315
332
 
@@ -557,7 +574,7 @@ const getPreviousOverloadSibling = (node) => {
557
574
  * Retrieves the JSDoc comment for a given node.
558
575
  *
559
576
  * @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode
560
- * @param {ESLintOrTSNode} node The AST node to get
577
+ * @param {ESLintOrTSNodeInput} node The AST node to get
561
578
  * the comment for.
562
579
  * @param {Settings} settings The settings in context
563
580
  * @param {{checkOverloads?: boolean}} [opts]
@@ -592,7 +609,7 @@ const getJSDocComment = function (sourceCode, node, settings, opts = {}) {
592
609
  * Retrieves the comment preceding a given node.
593
610
  *
594
611
  * @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode
595
- * @param {ESLintOrTSNode} node The AST node to get
612
+ * @param {ESLintOrTSNodeInput} node The AST node to get
596
613
  * the comment for.
597
614
  * @param {{maxLines: int, minLines: int, [name: string]: any}} settings The
598
615
  * settings in context
@@ -629,12 +646,13 @@ const compareLocEndToStart = (nodeA, nodeB) => {
629
646
  * This method is experimental.
630
647
  *
631
648
  * @param {import('eslint').SourceCode} sourceCode
632
- * @param {ESLintOrTSNode} astNode The AST node to get
649
+ * @param {ESLintOrTSNodeInput} astNodeInput The AST node to get
633
650
  * the comment for.
634
651
  * @returns {Token|null} The comment token containing the comment
635
652
  * for the given node or null if not found.
636
653
  */
637
- const getFollowingComment = function (sourceCode, astNode) {
654
+ const getFollowingComment = function (sourceCode, astNodeInput) {
655
+ const astNode = /** @type {ESLintOrTSNode} */ (astNodeInput);
638
656
  /**
639
657
  * @param {ESLintOrTSNode} node The
640
658
  * AST node to get the comment for.
@@ -64,7 +64,9 @@ function parseDescription (description) {
64
64
  mtch
65
65
  );
66
66
  const {tag, namepathOrURL, text} = match.groups;
67
- const [start, end] = match.indices[0];
67
+ // `indices[0]` (the whole-match span) is always present for a successful
68
+ // match under the `d` flag, though the type includes `undefined`.
69
+ const [start, end] = /** @type {[number, number]} */ (match.indices[0]);
68
70
  const format = determineFormat(match);
69
71
  const decodedText = decodeInlineTagText(text, format);
70
72