typedoc 0.26.11 → 0.27.0-beta.1

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 (338) hide show
  1. package/bin/package.json +3 -0
  2. package/bin/typedoc +1 -1
  3. package/dist/index.d.ts +23 -13
  4. package/dist/index.js +22 -81
  5. package/dist/lib/application-events.js +1 -4
  6. package/dist/lib/application.d.ts +26 -16
  7. package/dist/lib/application.js +222 -242
  8. package/dist/lib/cli.js +3 -40
  9. package/dist/lib/converter/comments/blockLexer.d.ts +1 -1
  10. package/dist/lib/converter/comments/blockLexer.js +24 -30
  11. package/dist/lib/converter/comments/declarationReference.js +10 -21
  12. package/dist/lib/converter/comments/declarationReferenceResolver.d.ts +2 -2
  13. package/dist/lib/converter/comments/declarationReferenceResolver.js +40 -36
  14. package/dist/lib/converter/comments/discovery.d.ts +4 -4
  15. package/dist/lib/converter/comments/discovery.js +154 -172
  16. package/dist/lib/converter/comments/index.d.ts +4 -4
  17. package/dist/lib/converter/comments/index.js +39 -50
  18. package/dist/lib/converter/comments/lexer.d.ts +1 -1
  19. package/dist/lib/converter/comments/lexer.js +2 -5
  20. package/dist/lib/converter/comments/lineLexer.d.ts +1 -1
  21. package/dist/lib/converter/comments/lineLexer.js +12 -15
  22. package/dist/lib/converter/comments/linkResolver.d.ts +2 -2
  23. package/dist/lib/converter/comments/linkResolver.js +14 -21
  24. package/dist/lib/converter/comments/parser.d.ts +6 -6
  25. package/dist/lib/converter/comments/parser.js +69 -96
  26. package/dist/lib/converter/comments/rawLexer.d.ts +1 -1
  27. package/dist/lib/converter/comments/rawLexer.js +13 -16
  28. package/dist/lib/converter/comments/tagName.js +1 -4
  29. package/dist/lib/converter/comments/textParser.d.ts +4 -4
  30. package/dist/lib/converter/comments/textParser.js +28 -30
  31. package/dist/lib/converter/components.d.ts +2 -3
  32. package/dist/lib/converter/components.js +2 -7
  33. package/dist/lib/converter/context.d.ts +9 -9
  34. package/dist/lib/converter/context.js +54 -44
  35. package/dist/lib/converter/convert-expression.js +16 -23
  36. package/dist/lib/converter/converter-events.d.ts +1 -0
  37. package/dist/lib/converter/converter-events.js +2 -4
  38. package/dist/lib/converter/converter.d.ts +16 -13
  39. package/dist/lib/converter/converter.js +212 -239
  40. package/dist/lib/converter/factories/index-signature.d.ts +3 -3
  41. package/dist/lib/converter/factories/index-signature.js +43 -26
  42. package/dist/lib/converter/factories/signature.d.ts +2 -2
  43. package/dist/lib/converter/factories/signature.js +95 -106
  44. package/dist/lib/converter/index.d.ts +6 -7
  45. package/dist/lib/converter/index.js +3 -11
  46. package/dist/lib/converter/jsdoc.d.ts +1 -1
  47. package/dist/lib/converter/jsdoc.js +34 -41
  48. package/dist/lib/converter/plugins/CategoryPlugin.d.ts +6 -21
  49. package/dist/lib/converter/plugins/CategoryPlugin.js +57 -139
  50. package/dist/lib/converter/plugins/CommentPlugin.d.ts +3 -5
  51. package/dist/lib/converter/plugins/CommentPlugin.js +153 -163
  52. package/dist/lib/converter/plugins/GroupPlugin.d.ts +10 -9
  53. package/dist/lib/converter/plugins/GroupPlugin.js +87 -124
  54. package/dist/lib/converter/plugins/ImplementsPlugin.d.ts +3 -5
  55. package/dist/lib/converter/plugins/ImplementsPlugin.js +255 -321
  56. package/dist/lib/converter/plugins/IncludePlugin.d.ts +11 -0
  57. package/dist/lib/converter/plugins/IncludePlugin.js +72 -0
  58. package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +4 -3
  59. package/dist/lib/converter/plugins/InheritDocPlugin.js +41 -72
  60. package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +5 -5
  61. package/dist/lib/converter/plugins/LinkResolverPlugin.js +37 -58
  62. package/dist/lib/converter/plugins/MergeModuleWithPlugin.d.ts +12 -0
  63. package/dist/lib/converter/plugins/MergeModuleWithPlugin.js +49 -0
  64. package/dist/lib/converter/plugins/PackagePlugin.d.ts +4 -3
  65. package/dist/lib/converter/plugins/PackagePlugin.js +62 -111
  66. package/dist/lib/converter/plugins/SourcePlugin.d.ts +3 -5
  67. package/dist/lib/converter/plugins/SourcePlugin.js +69 -110
  68. package/dist/lib/converter/plugins/TypePlugin.d.ts +4 -6
  69. package/dist/lib/converter/plugins/TypePlugin.js +95 -158
  70. package/dist/lib/converter/plugins/index.d.ts +10 -9
  71. package/dist/lib/converter/plugins/index.js +10 -21
  72. package/dist/lib/converter/symbols.d.ts +1 -1
  73. package/dist/lib/converter/symbols.js +234 -227
  74. package/dist/lib/converter/types.d.ts +2 -2
  75. package/dist/lib/converter/types.js +252 -237
  76. package/dist/lib/converter/utils/nodes.js +5 -13
  77. package/dist/lib/converter/utils/reflections.d.ts +1 -1
  78. package/dist/lib/converter/utils/reflections.js +4 -7
  79. package/dist/lib/converter/utils/repository.d.ts +1 -1
  80. package/dist/lib/converter/utils/repository.js +103 -97
  81. package/dist/lib/converter/utils/symbols.js +3 -9
  82. package/dist/lib/internationalization/index.d.ts +3 -4
  83. package/dist/lib/internationalization/index.js +3 -8
  84. package/dist/lib/internationalization/internationalization.d.ts +5 -4
  85. package/dist/lib/internationalization/internationalization.js +97 -103
  86. package/dist/lib/internationalization/locale-utils.cjs +8 -0
  87. package/dist/lib/internationalization/locale-utils.d.cts +8 -0
  88. package/dist/lib/internationalization/locales/en.cjs +372 -2
  89. package/dist/lib/internationalization/locales/en.d.cts +343 -2
  90. package/dist/lib/internationalization/locales/jp.cjs +13 -14
  91. package/dist/lib/internationalization/locales/jp.d.cts +307 -1
  92. package/dist/lib/internationalization/locales/ko.cjs +12 -11
  93. package/dist/lib/internationalization/locales/ko.d.cts +221 -1
  94. package/dist/lib/internationalization/locales/zh.cjs +43 -19
  95. package/dist/lib/internationalization/locales/zh.d.cts +409 -1
  96. package/dist/lib/internationalization/translatable.d.ts +4 -327
  97. package/dist/lib/internationalization/translatable.js +2 -360
  98. package/dist/lib/models/FileRegistry.d.ts +20 -9
  99. package/dist/lib/models/FileRegistry.js +54 -45
  100. package/dist/lib/models/ReflectionCategory.d.ts +2 -2
  101. package/dist/lib/models/ReflectionCategory.js +16 -12
  102. package/dist/lib/models/ReflectionGroup.d.ts +3 -3
  103. package/dist/lib/models/ReflectionGroup.js +23 -14
  104. package/dist/lib/models/comments/comment.d.ts +23 -37
  105. package/dist/lib/models/comments/comment.js +388 -325
  106. package/dist/lib/models/comments/index.d.ts +2 -2
  107. package/dist/lib/models/comments/index.js +1 -6
  108. package/dist/lib/models/index.d.ts +7 -7
  109. package/dist/lib/models/index.js +7 -23
  110. package/dist/lib/models/reflections/ReflectionSymbolId.d.ts +2 -2
  111. package/dist/lib/models/reflections/ReflectionSymbolId.js +42 -34
  112. package/dist/lib/models/reflections/abstract.d.ts +17 -20
  113. package/dist/lib/models/reflections/abstract.js +249 -256
  114. package/dist/lib/models/reflections/container.d.ts +7 -7
  115. package/dist/lib/models/reflections/container.js +43 -16
  116. package/dist/lib/models/reflections/declaration.d.ts +15 -12
  117. package/dist/lib/models/reflections/declaration.js +150 -29
  118. package/dist/lib/models/reflections/document.d.ts +3 -3
  119. package/dist/lib/models/reflections/document.js +26 -13
  120. package/dist/lib/models/reflections/index.d.ts +15 -15
  121. package/dist/lib/models/reflections/index.js +12 -31
  122. package/dist/lib/models/reflections/kind.d.ts +1 -1
  123. package/dist/lib/models/reflections/kind.js +3 -6
  124. package/dist/lib/models/reflections/parameter.d.ts +5 -4
  125. package/dist/lib/models/reflections/parameter.js +11 -13
  126. package/dist/lib/models/reflections/project.d.ts +14 -9
  127. package/dist/lib/models/reflections/project.js +104 -56
  128. package/dist/lib/models/reflections/reference.d.ts +3 -3
  129. package/dist/lib/models/reflections/reference.js +6 -9
  130. package/dist/lib/models/reflections/signature.d.ts +8 -8
  131. package/dist/lib/models/reflections/signature.js +35 -14
  132. package/dist/lib/models/reflections/type-parameter.d.ts +5 -5
  133. package/dist/lib/models/reflections/type-parameter.js +9 -10
  134. package/dist/lib/models/reflections/utils.js +1 -4
  135. package/dist/lib/models/reflections/variant.d.ts +8 -7
  136. package/dist/lib/models/reflections/variant.js +1 -2
  137. package/dist/lib/models/sources/file.d.ts +2 -2
  138. package/dist/lib/models/sources/file.js +22 -5
  139. package/dist/lib/models/sources/index.d.ts +1 -1
  140. package/dist/lib/models/sources/index.js +1 -5
  141. package/dist/lib/models/types.d.ts +29 -16
  142. package/dist/lib/models/types.js +236 -151
  143. package/dist/lib/output/components.d.ts +5 -11
  144. package/dist/lib/output/components.js +84 -125
  145. package/dist/lib/output/events.d.ts +3 -3
  146. package/dist/lib/output/events.js +128 -94
  147. package/dist/lib/output/formatter.d.ts +84 -0
  148. package/dist/lib/output/formatter.js +624 -0
  149. package/dist/lib/output/index.d.ts +9 -8
  150. package/dist/lib/output/index.js +7 -19
  151. package/dist/lib/output/models/UrlMapping.d.ts +2 -2
  152. package/dist/lib/output/models/UrlMapping.js +4 -5
  153. package/dist/lib/output/output.d.ts +14 -0
  154. package/dist/lib/output/output.js +91 -0
  155. package/dist/lib/output/plugins/AssetsPlugin.d.ts +9 -8
  156. package/dist/lib/output/plugins/AssetsPlugin.js +64 -80
  157. package/dist/lib/output/plugins/HierarchyPlugin.d.ts +7 -0
  158. package/dist/lib/output/plugins/HierarchyPlugin.js +67 -0
  159. package/dist/lib/output/plugins/IconsPlugin.d.ts +3 -2
  160. package/dist/lib/output/plugins/IconsPlugin.js +28 -84
  161. package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +9 -2
  162. package/dist/lib/output/plugins/JavascriptIndexPlugin.js +90 -96
  163. package/dist/lib/output/plugins/NavigationPlugin.d.ts +3 -2
  164. package/dist/lib/output/plugins/NavigationPlugin.js +22 -102
  165. package/dist/lib/output/plugins/SitemapPlugin.d.ts +3 -2
  166. package/dist/lib/output/plugins/SitemapPlugin.js +60 -120
  167. package/dist/lib/output/plugins/index.d.ts +7 -6
  168. package/dist/lib/output/plugins/index.js +7 -15
  169. package/dist/lib/output/renderer.d.ts +14 -13
  170. package/dist/lib/output/renderer.js +130 -185
  171. package/dist/lib/output/theme.d.ts +9 -5
  172. package/dist/lib/output/theme.js +14 -62
  173. package/dist/lib/output/themes/MarkedPlugin.d.ts +8 -9
  174. package/dist/lib/output/themes/MarkedPlugin.js +152 -117
  175. package/dist/lib/output/themes/default/DefaultTheme.d.ts +17 -29
  176. package/dist/lib/output/themes/default/DefaultTheme.js +334 -310
  177. package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +63 -48
  178. package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +119 -95
  179. package/dist/lib/output/themes/default/Slugger.d.ts +13 -0
  180. package/dist/lib/output/themes/default/Slugger.js +46 -0
  181. package/dist/lib/output/themes/default/layouts/default.d.ts +5 -5
  182. package/dist/lib/output/themes/default/layouts/default.js +48 -36
  183. package/dist/lib/output/themes/default/partials/anchor-icon.d.ts +2 -2
  184. package/dist/lib/output/themes/default/partials/anchor-icon.js +4 -7
  185. package/dist/lib/output/themes/default/partials/breadcrumb.d.ts +3 -3
  186. package/dist/lib/output/themes/default/partials/breadcrumb.js +4 -8
  187. package/dist/lib/output/themes/default/partials/comment.d.ts +6 -4
  188. package/dist/lib/output/themes/default/partials/comment.js +52 -29
  189. package/dist/lib/output/themes/default/partials/footer.d.ts +2 -2
  190. package/dist/lib/output/themes/default/partials/footer.js +11 -14
  191. package/dist/lib/output/themes/default/partials/header.d.ts +4 -4
  192. package/dist/lib/output/themes/default/partials/header.js +9 -13
  193. package/dist/lib/output/themes/default/partials/hierarchy.d.ts +4 -4
  194. package/dist/lib/output/themes/default/partials/hierarchy.js +12 -15
  195. package/dist/lib/output/themes/default/partials/icon.d.ts +4 -4
  196. package/dist/lib/output/themes/default/partials/icon.js +78 -73
  197. package/dist/lib/output/themes/default/partials/index.d.ts +3 -3
  198. package/dist/lib/output/themes/default/partials/index.js +19 -22
  199. package/dist/lib/output/themes/default/partials/member.d.ts +3 -3
  200. package/dist/lib/output/themes/default/partials/member.declaration.d.ts +3 -3
  201. package/dist/lib/output/themes/default/partials/member.declaration.js +18 -61
  202. package/dist/lib/output/themes/default/partials/member.getterSetter.d.ts +3 -3
  203. package/dist/lib/output/themes/default/partials/member.getterSetter.js +10 -26
  204. package/dist/lib/output/themes/default/partials/member.js +19 -24
  205. package/dist/lib/output/themes/default/partials/member.signature.body.d.ts +3 -3
  206. package/dist/lib/output/themes/default/partials/member.signature.body.js +17 -21
  207. package/dist/lib/output/themes/default/partials/member.signature.title.d.ts +4 -7
  208. package/dist/lib/output/themes/default/partials/member.signature.title.js +8 -35
  209. package/dist/lib/output/themes/default/partials/member.signatures.d.ts +3 -3
  210. package/dist/lib/output/themes/default/partials/member.signatures.js +9 -13
  211. package/dist/lib/output/themes/default/partials/member.sources.d.ts +3 -3
  212. package/dist/lib/output/themes/default/partials/member.sources.js +13 -17
  213. package/dist/lib/output/themes/default/partials/members.d.ts +3 -3
  214. package/dist/lib/output/themes/default/partials/members.js +10 -42
  215. package/dist/lib/output/themes/default/partials/moduleReflection.d.ts +5 -0
  216. package/dist/lib/output/themes/default/partials/moduleReflection.js +62 -0
  217. package/dist/lib/output/themes/default/partials/navigation.d.ts +4 -4
  218. package/dist/lib/output/themes/default/partials/navigation.js +51 -62
  219. package/dist/lib/output/themes/default/partials/reflectionPreview.d.ts +3 -3
  220. package/dist/lib/output/themes/default/partials/reflectionPreview.js +12 -15
  221. package/dist/lib/output/themes/default/partials/toolbar.d.ts +4 -4
  222. package/dist/lib/output/themes/default/partials/toolbar.js +16 -20
  223. package/dist/lib/output/themes/default/partials/type.d.ts +4 -6
  224. package/dist/lib/output/themes/default/partials/type.js +8 -388
  225. package/dist/lib/output/themes/default/partials/typeAndParent.d.ts +3 -3
  226. package/dist/lib/output/themes/default/partials/typeAndParent.js +11 -15
  227. package/dist/lib/output/themes/default/partials/typeDetails.d.ts +8 -0
  228. package/dist/lib/output/themes/default/partials/typeDetails.js +222 -0
  229. package/dist/lib/output/themes/default/partials/typeParameters.d.ts +3 -3
  230. package/dist/lib/output/themes/default/partials/typeParameters.js +14 -17
  231. package/dist/lib/output/themes/default/templates/document.d.ts +4 -4
  232. package/dist/lib/output/themes/default/templates/document.js +3 -7
  233. package/dist/lib/output/themes/default/templates/hierarchy.d.ts +4 -4
  234. package/dist/lib/output/themes/default/templates/hierarchy.js +24 -22
  235. package/dist/lib/output/themes/default/templates/index.d.ts +4 -4
  236. package/dist/lib/output/themes/default/templates/index.js +3 -7
  237. package/dist/lib/output/themes/default/templates/reflection.d.ts +4 -4
  238. package/dist/lib/output/themes/default/templates/reflection.js +32 -34
  239. package/dist/lib/output/themes/lib.d.ts +17 -3
  240. package/dist/lib/output/themes/lib.js +118 -50
  241. package/dist/lib/serialization/components.d.ts +2 -5
  242. package/dist/lib/serialization/components.js +1 -2
  243. package/dist/lib/serialization/deserializer.d.ts +21 -7
  244. package/dist/lib/serialization/deserializer.js +138 -123
  245. package/dist/lib/serialization/events.d.ts +2 -2
  246. package/dist/lib/serialization/events.js +6 -5
  247. package/dist/lib/serialization/index.d.ts +5 -5
  248. package/dist/lib/serialization/index.js +4 -33
  249. package/dist/lib/serialization/schema.d.ts +8 -2
  250. package/dist/lib/serialization/schema.js +2 -2
  251. package/dist/lib/serialization/serializer.d.ts +11 -5
  252. package/dist/lib/serialization/serializer.js +32 -25
  253. package/dist/lib/utils/array.d.ts +3 -0
  254. package/dist/lib/utils/array.js +26 -27
  255. package/dist/lib/utils/component.d.ts +2 -44
  256. package/dist/lib/utils/component.js +10 -102
  257. package/dist/lib/utils/entry-point.d.ts +3 -4
  258. package/dist/lib/utils/entry-point.js +114 -85
  259. package/dist/lib/utils/enum.js +6 -14
  260. package/dist/lib/utils/events.js +6 -12
  261. package/dist/lib/utils/fs.js +50 -91
  262. package/dist/lib/utils/general.d.ts +2 -1
  263. package/dist/lib/utils/general.js +50 -40
  264. package/dist/lib/utils/highlighter.js +30 -57
  265. package/dist/lib/utils/hooks.js +7 -13
  266. package/dist/lib/utils/html-entities.d.ts +8926 -0
  267. package/dist/lib/utils/html-entities.js +2329 -0
  268. package/dist/lib/utils/html.d.ts +8 -0
  269. package/dist/lib/utils/html.js +81 -34
  270. package/dist/lib/utils/index.d.ts +22 -22
  271. package/dist/lib/utils/index.js +20 -91
  272. package/dist/lib/utils/jsx.d.ts +12 -6
  273. package/dist/lib/utils/jsx.elements.d.ts +1 -1
  274. package/dist/lib/utils/jsx.elements.js +3 -4
  275. package/dist/lib/utils/jsx.js +82 -52
  276. package/dist/lib/utils/loggers.d.ts +3 -3
  277. package/dist/lib/utils/loggers.js +36 -46
  278. package/dist/lib/utils/map.js +6 -13
  279. package/dist/lib/utils/minimalSourceFile.js +5 -7
  280. package/dist/lib/utils/options/declaration.d.ts +35 -7
  281. package/dist/lib/utils/options/declaration.js +20 -22
  282. package/dist/lib/utils/options/defaults.d.ts +3 -2
  283. package/dist/lib/utils/options/defaults.js +18 -38
  284. package/dist/lib/utils/options/help.d.ts +2 -2
  285. package/dist/lib/utils/options/help.js +7 -10
  286. package/dist/lib/utils/options/index.d.ts +6 -6
  287. package/dist/lib/utils/options/index.js +4 -18
  288. package/dist/lib/utils/options/options.d.ts +8 -5
  289. package/dist/lib/utils/options/options.js +47 -71
  290. package/dist/lib/utils/options/readers/arguments.d.ts +2 -2
  291. package/dist/lib/utils/options/readers/arguments.js +15 -17
  292. package/dist/lib/utils/options/readers/index.d.ts +4 -4
  293. package/dist/lib/utils/options/readers/index.js +4 -11
  294. package/dist/lib/utils/options/readers/package-json.d.ts +3 -3
  295. package/dist/lib/utils/options/readers/package-json.js +15 -21
  296. package/dist/lib/utils/options/readers/tsconfig.d.ts +2 -2
  297. package/dist/lib/utils/options/readers/tsconfig.js +54 -63
  298. package/dist/lib/utils/options/readers/typedoc.d.ts +3 -3
  299. package/dist/lib/utils/options/readers/typedoc.js +44 -76
  300. package/dist/lib/utils/options/sources/index.d.ts +1 -1
  301. package/dist/lib/utils/options/sources/index.js +1 -5
  302. package/dist/lib/utils/options/sources/typedoc.d.ts +1 -1
  303. package/dist/lib/utils/options/sources/typedoc.js +232 -196
  304. package/dist/lib/utils/options/tsdoc-defaults.d.ts +3 -3
  305. package/dist/lib/utils/options/tsdoc-defaults.js +16 -12
  306. package/dist/lib/utils/package-manifest.d.ts +1 -1
  307. package/dist/lib/utils/package-manifest.js +15 -19
  308. package/dist/lib/utils/paths.js +9 -15
  309. package/dist/lib/utils/perf.js +6 -11
  310. package/dist/lib/utils/plugins.d.ts +1 -1
  311. package/dist/lib/utils/plugins.js +7 -10
  312. package/dist/lib/utils/reflections.d.ts +1 -1
  313. package/dist/lib/utils/reflections.js +9 -12
  314. package/dist/lib/utils/set.js +2 -6
  315. package/dist/lib/utils/sort.d.ts +3 -3
  316. package/dist/lib/utils/sort.js +20 -24
  317. package/dist/lib/utils/tsconfig.d.ts +1 -1
  318. package/dist/lib/utils/tsconfig.js +13 -21
  319. package/dist/lib/utils/tsutils.d.ts +1 -1
  320. package/dist/lib/utils/tsutils.js +3 -30
  321. package/dist/lib/utils/validation.js +6 -12
  322. package/dist/lib/validation/documentation.d.ts +2 -2
  323. package/dist/lib/validation/documentation.js +26 -29
  324. package/dist/lib/validation/exports.d.ts +2 -2
  325. package/dist/lib/validation/exports.js +9 -11
  326. package/dist/lib/validation/links.d.ts +2 -2
  327. package/dist/lib/validation/links.js +4 -7
  328. package/dist/lib/validation/unusedMergeModuleWith.d.ts +3 -0
  329. package/dist/lib/validation/unusedMergeModuleWith.js +11 -0
  330. package/package.json +17 -14
  331. package/static/main.js +4 -4
  332. package/static/style.css +109 -17
  333. package/tsdoc.json +30 -0
  334. package/dist/lib/output/themes/default/partials/member.reference.d.ts +0 -4
  335. package/dist/lib/output/themes/default/partials/member.reference.js +0 -30
  336. package/dist/lib/output/themes/default/partials/parameter.d.ts +0 -4
  337. package/dist/lib/output/themes/default/partials/parameter.js +0 -79
  338. package/dist/lib/utils/html-entities.json +0 -2326
@@ -1,151 +1,119 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.discoverFileComments = discoverFileComments;
30
- exports.discoverNodeComment = discoverNodeComment;
31
- exports.discoverComment = discoverComment;
32
- exports.discoverSignatureComment = discoverSignatureComment;
33
- const typescript_1 = __importDefault(require("typescript"));
34
- const models_1 = require("../../models");
35
- const utils_1 = require("../../utils");
36
- const declaration_1 = require("../../utils/options/declaration");
37
- const paths_1 = require("../../utils/paths");
38
- const assert_1 = __importStar(require("assert"));
39
- const array_1 = require("../../utils/array");
1
+ import ts from "typescript";
2
+ import { ReflectionKind } from "../../models/index.js";
3
+ import { assertNever } from "../../utils/index.js";
4
+ import { CommentStyle } from "../../utils/options/declaration.js";
5
+ import { nicePath } from "../../utils/paths.js";
6
+ import { ok } from "assert";
7
+ import { filter, firstDefined } from "../../utils/array.js";
40
8
  const variablePropertyKinds = [
41
- typescript_1.default.SyntaxKind.PropertyDeclaration,
42
- typescript_1.default.SyntaxKind.PropertySignature,
43
- typescript_1.default.SyntaxKind.BinaryExpression,
44
- typescript_1.default.SyntaxKind.PropertyAssignment,
45
- typescript_1.default.SyntaxKind.ShorthandPropertyAssignment,
9
+ ts.SyntaxKind.PropertyDeclaration,
10
+ ts.SyntaxKind.PropertySignature,
11
+ ts.SyntaxKind.BinaryExpression,
12
+ ts.SyntaxKind.PropertyAssignment,
13
+ ts.SyntaxKind.ShorthandPropertyAssignment,
46
14
  // class X { constructor(/** Comment */ readonly z: string) }
47
- typescript_1.default.SyntaxKind.Parameter,
15
+ ts.SyntaxKind.Parameter,
48
16
  // Variable values
49
- typescript_1.default.SyntaxKind.VariableDeclaration,
50
- typescript_1.default.SyntaxKind.BindingElement,
51
- typescript_1.default.SyntaxKind.ExportAssignment,
52
- typescript_1.default.SyntaxKind.PropertyAccessExpression,
17
+ ts.SyntaxKind.VariableDeclaration,
18
+ ts.SyntaxKind.BindingElement,
19
+ ts.SyntaxKind.ExportAssignment,
20
+ ts.SyntaxKind.PropertyAccessExpression,
53
21
  ];
54
22
  // Note: This does NOT include JSDoc syntax kinds. This is important!
55
23
  // Comments from @typedef and @callback tags are handled specially by
56
24
  // the JSDoc converter because we only want part of the comment when
57
25
  // getting them.
58
26
  const wantedKinds = {
59
- [models_1.ReflectionKind.Project]: [
60
- typescript_1.default.SyntaxKind.SourceFile,
61
- typescript_1.default.SyntaxKind.ModuleDeclaration,
27
+ [ReflectionKind.Project]: [
28
+ ts.SyntaxKind.SourceFile,
29
+ ts.SyntaxKind.ModuleDeclaration,
62
30
  ],
63
- [models_1.ReflectionKind.Module]: [
64
- typescript_1.default.SyntaxKind.SourceFile,
65
- typescript_1.default.SyntaxKind.ModuleDeclaration,
31
+ [ReflectionKind.Module]: [
32
+ ts.SyntaxKind.SourceFile,
33
+ ts.SyntaxKind.ModuleDeclaration,
66
34
  ],
67
- [models_1.ReflectionKind.Namespace]: [
68
- typescript_1.default.SyntaxKind.ModuleDeclaration,
69
- typescript_1.default.SyntaxKind.SourceFile,
70
- typescript_1.default.SyntaxKind.BindingElement,
71
- typescript_1.default.SyntaxKind.ExportSpecifier,
72
- typescript_1.default.SyntaxKind.NamespaceExport,
35
+ [ReflectionKind.Namespace]: [
36
+ ts.SyntaxKind.ModuleDeclaration,
37
+ ts.SyntaxKind.SourceFile,
38
+ ts.SyntaxKind.BindingElement,
39
+ ts.SyntaxKind.ExportSpecifier,
40
+ ts.SyntaxKind.NamespaceExport,
73
41
  // @namespace support
74
- typescript_1.default.SyntaxKind.VariableDeclaration,
75
- typescript_1.default.SyntaxKind.BindingElement,
76
- typescript_1.default.SyntaxKind.ExportAssignment,
77
- typescript_1.default.SyntaxKind.PropertyAccessExpression,
78
- typescript_1.default.SyntaxKind.PropertyDeclaration,
79
- typescript_1.default.SyntaxKind.PropertyAssignment,
80
- typescript_1.default.SyntaxKind.ShorthandPropertyAssignment,
42
+ ts.SyntaxKind.VariableDeclaration,
43
+ ts.SyntaxKind.BindingElement,
44
+ ts.SyntaxKind.ExportAssignment,
45
+ ts.SyntaxKind.PropertyAccessExpression,
46
+ ts.SyntaxKind.PropertyDeclaration,
47
+ ts.SyntaxKind.PropertyAssignment,
48
+ ts.SyntaxKind.ShorthandPropertyAssignment,
81
49
  ],
82
- [models_1.ReflectionKind.Enum]: [
83
- typescript_1.default.SyntaxKind.EnumDeclaration,
84
- typescript_1.default.SyntaxKind.VariableDeclaration,
50
+ [ReflectionKind.Enum]: [
51
+ ts.SyntaxKind.EnumDeclaration,
52
+ ts.SyntaxKind.VariableDeclaration,
85
53
  ],
86
- [models_1.ReflectionKind.EnumMember]: [
87
- typescript_1.default.SyntaxKind.EnumMember,
54
+ [ReflectionKind.EnumMember]: [
55
+ ts.SyntaxKind.EnumMember,
88
56
  // These here so that @enum gets comments
89
- typescript_1.default.SyntaxKind.PropertyAssignment,
90
- typescript_1.default.SyntaxKind.PropertySignature,
57
+ ts.SyntaxKind.PropertyAssignment,
58
+ ts.SyntaxKind.PropertySignature,
91
59
  ],
92
- [models_1.ReflectionKind.Variable]: variablePropertyKinds,
93
- [models_1.ReflectionKind.Function]: [
94
- typescript_1.default.SyntaxKind.FunctionDeclaration,
95
- typescript_1.default.SyntaxKind.BindingElement,
96
- typescript_1.default.SyntaxKind.VariableDeclaration,
97
- typescript_1.default.SyntaxKind.ExportAssignment,
98
- typescript_1.default.SyntaxKind.PropertyAccessExpression,
99
- typescript_1.default.SyntaxKind.PropertyDeclaration,
100
- typescript_1.default.SyntaxKind.PropertyAssignment,
101
- typescript_1.default.SyntaxKind.ShorthandPropertyAssignment,
60
+ [ReflectionKind.Variable]: variablePropertyKinds,
61
+ [ReflectionKind.Function]: [
62
+ ts.SyntaxKind.FunctionDeclaration,
63
+ ts.SyntaxKind.BindingElement,
64
+ ts.SyntaxKind.VariableDeclaration,
65
+ ts.SyntaxKind.ExportAssignment,
66
+ ts.SyntaxKind.PropertyAccessExpression,
67
+ ts.SyntaxKind.PropertyDeclaration,
68
+ ts.SyntaxKind.PropertyAssignment,
69
+ ts.SyntaxKind.ShorthandPropertyAssignment,
102
70
  ],
103
- [models_1.ReflectionKind.Class]: [
104
- typescript_1.default.SyntaxKind.ClassDeclaration,
105
- typescript_1.default.SyntaxKind.BindingElement,
71
+ [ReflectionKind.Class]: [
72
+ ts.SyntaxKind.ClassDeclaration,
73
+ ts.SyntaxKind.BindingElement,
106
74
  // If marked with @class
107
- typescript_1.default.SyntaxKind.VariableDeclaration,
108
- typescript_1.default.SyntaxKind.ExportAssignment,
109
- typescript_1.default.SyntaxKind.FunctionDeclaration,
75
+ ts.SyntaxKind.VariableDeclaration,
76
+ ts.SyntaxKind.ExportAssignment,
77
+ ts.SyntaxKind.FunctionDeclaration,
110
78
  ],
111
- [models_1.ReflectionKind.Interface]: [
112
- typescript_1.default.SyntaxKind.InterfaceDeclaration,
113
- typescript_1.default.SyntaxKind.TypeAliasDeclaration,
79
+ [ReflectionKind.Interface]: [
80
+ ts.SyntaxKind.InterfaceDeclaration,
81
+ ts.SyntaxKind.TypeAliasDeclaration,
114
82
  ],
115
- [models_1.ReflectionKind.Constructor]: [typescript_1.default.SyntaxKind.Constructor],
116
- [models_1.ReflectionKind.Property]: variablePropertyKinds,
117
- [models_1.ReflectionKind.Method]: [
118
- typescript_1.default.SyntaxKind.FunctionDeclaration,
119
- typescript_1.default.SyntaxKind.MethodDeclaration,
83
+ [ReflectionKind.Constructor]: [ts.SyntaxKind.Constructor],
84
+ [ReflectionKind.Property]: variablePropertyKinds,
85
+ [ReflectionKind.Method]: [
86
+ ts.SyntaxKind.FunctionDeclaration,
87
+ ts.SyntaxKind.MethodDeclaration,
120
88
  ],
121
- [models_1.ReflectionKind.CallSignature]: [
122
- typescript_1.default.SyntaxKind.FunctionDeclaration,
123
- typescript_1.default.SyntaxKind.VariableDeclaration,
124
- typescript_1.default.SyntaxKind.MethodDeclaration,
125
- typescript_1.default.SyntaxKind.MethodDeclaration,
126
- typescript_1.default.SyntaxKind.PropertyDeclaration,
127
- typescript_1.default.SyntaxKind.PropertySignature,
128
- typescript_1.default.SyntaxKind.CallSignature,
89
+ [ReflectionKind.CallSignature]: [
90
+ ts.SyntaxKind.FunctionDeclaration,
91
+ ts.SyntaxKind.VariableDeclaration,
92
+ ts.SyntaxKind.MethodDeclaration,
93
+ ts.SyntaxKind.MethodDeclaration,
94
+ ts.SyntaxKind.PropertyDeclaration,
95
+ ts.SyntaxKind.PropertySignature,
96
+ ts.SyntaxKind.CallSignature,
129
97
  ],
130
- [models_1.ReflectionKind.IndexSignature]: [typescript_1.default.SyntaxKind.IndexSignature],
131
- [models_1.ReflectionKind.ConstructorSignature]: [typescript_1.default.SyntaxKind.ConstructSignature],
132
- [models_1.ReflectionKind.Parameter]: [typescript_1.default.SyntaxKind.Parameter],
133
- [models_1.ReflectionKind.TypeLiteral]: [typescript_1.default.SyntaxKind.TypeLiteral],
134
- [models_1.ReflectionKind.TypeParameter]: [typescript_1.default.SyntaxKind.TypeParameter],
135
- [models_1.ReflectionKind.Accessor]: [typescript_1.default.SyntaxKind.PropertyDeclaration],
136
- [models_1.ReflectionKind.GetSignature]: [typescript_1.default.SyntaxKind.GetAccessor],
137
- [models_1.ReflectionKind.SetSignature]: [typescript_1.default.SyntaxKind.SetAccessor],
138
- [models_1.ReflectionKind.TypeAlias]: [typescript_1.default.SyntaxKind.TypeAliasDeclaration],
139
- [models_1.ReflectionKind.Reference]: [
140
- typescript_1.default.SyntaxKind.NamespaceExport,
141
- typescript_1.default.SyntaxKind.ExportSpecifier,
98
+ [ReflectionKind.IndexSignature]: [ts.SyntaxKind.IndexSignature],
99
+ [ReflectionKind.ConstructorSignature]: [ts.SyntaxKind.ConstructSignature],
100
+ [ReflectionKind.Parameter]: [ts.SyntaxKind.Parameter],
101
+ [ReflectionKind.TypeLiteral]: [ts.SyntaxKind.TypeLiteral],
102
+ [ReflectionKind.TypeParameter]: [ts.SyntaxKind.TypeParameter],
103
+ [ReflectionKind.Accessor]: [ts.SyntaxKind.PropertyDeclaration],
104
+ [ReflectionKind.GetSignature]: [ts.SyntaxKind.GetAccessor],
105
+ [ReflectionKind.SetSignature]: [ts.SyntaxKind.SetAccessor],
106
+ [ReflectionKind.TypeAlias]: [ts.SyntaxKind.TypeAliasDeclaration],
107
+ [ReflectionKind.Reference]: [
108
+ ts.SyntaxKind.NamespaceExport,
109
+ ts.SyntaxKind.ExportSpecifier,
142
110
  ],
143
111
  // Non-TS kind, will never have comments.
144
- [models_1.ReflectionKind.Document]: [],
112
+ [ReflectionKind.Document]: [],
145
113
  };
146
- function discoverFileComments(node, commentStyle) {
114
+ export function discoverFileComments(node, commentStyle) {
147
115
  const text = node.text;
148
- const comments = collectCommentRanges(typescript_1.default.getLeadingCommentRanges(text, node.pos));
116
+ const comments = collectCommentRanges(ts.getLeadingCommentRanges(text, node.pos));
149
117
  const selectedDocComments = comments.filter((ranges) => permittedRange(text, ranges, commentStyle));
150
118
  return selectedDocComments.map((ranges) => {
151
119
  return {
@@ -156,9 +124,9 @@ function discoverFileComments(node, commentStyle) {
156
124
  };
157
125
  });
158
126
  }
159
- function discoverNodeComment(node, commentStyle) {
127
+ export function discoverNodeComment(node, commentStyle) {
160
128
  const text = node.getSourceFile().text;
161
- const comments = collectCommentRanges(typescript_1.default.getLeadingCommentRanges(text, node.pos));
129
+ const comments = collectCommentRanges(ts.getLeadingCommentRanges(text, node.pos));
162
130
  comments.reverse();
163
131
  const selectedDocComment = comments.find((ranges) => permittedRange(text, ranges, commentStyle));
164
132
  if (selectedDocComment) {
@@ -174,7 +142,7 @@ function checkCommentDeclarations(commentNodes, reverse, commentStyle) {
174
142
  const discovered = [];
175
143
  for (const { node, inheritedFromParentDeclaration } of commentNodes) {
176
144
  const text = node.getSourceFile().text;
177
- const comments = collectCommentRanges(typescript_1.default.getLeadingCommentRanges(text, node.pos));
145
+ const comments = collectCommentRanges(ts.getLeadingCommentRanges(text, node.pos));
178
146
  if (reverse) {
179
147
  comments.reverse();
180
148
  }
@@ -190,22 +158,22 @@ function checkCommentDeclarations(commentNodes, reverse, commentStyle) {
190
158
  }
191
159
  return discovered;
192
160
  }
193
- function discoverComment(symbol, kind, logger, commentStyle, checker) {
161
+ export function discoverComment(symbol, kind, logger, commentStyle, checker, declarationWarnings) {
194
162
  // For a module comment, we want the first one defined in the file,
195
163
  // not the last one, since that will apply to the import or declaration.
196
- const reverse = !symbol.declarations?.some(typescript_1.default.isSourceFile);
197
- const wantedDeclarations = (0, array_1.filter)(symbol.declarations, (decl) => wantedKinds[kind].includes(decl.kind));
164
+ const reverse = !symbol.declarations?.some(ts.isSourceFile);
165
+ const wantedDeclarations = filter(symbol.declarations, (decl) => wantedKinds[kind].includes(decl.kind));
198
166
  const commentNodes = wantedDeclarations.flatMap((decl) => declarationToCommentNodes(decl, checker));
199
167
  // Special behavior here!
200
168
  // Signatures and symbols have two distinct discovery methods as of TypeDoc 0.26.
201
169
  // This method discovers comments for symbols, and function-likes will only have
202
170
  // a symbol comment if there is more than one signature (== more than one declaration)
203
171
  // and there is a comment on the implementation signature.
204
- if (kind & models_1.ReflectionKind.ContainsCallSignatures) {
172
+ if (kind & ReflectionKind.ContainsCallSignatures) {
205
173
  const canHaveOverloads = wantedDeclarations.some((node) => [
206
- typescript_1.default.SyntaxKind.FunctionDeclaration,
207
- typescript_1.default.SyntaxKind.MethodDeclaration,
208
- typescript_1.default.SyntaxKind.Constructor,
174
+ ts.SyntaxKind.FunctionDeclaration,
175
+ ts.SyntaxKind.MethodDeclaration,
176
+ ts.SyntaxKind.Constructor,
209
177
  ].includes(node.kind));
210
178
  const isOverloaded = canHaveOverloads && wantedDeclarations.length > 1;
211
179
  if (isOverloaded) {
@@ -235,11 +203,13 @@ function discoverComment(symbol, kind, logger, commentStyle, checker) {
235
203
  return discovered[0];
236
204
  default: {
237
205
  if (discovered.filter((n) => !n.inheritedFromParentDeclaration)
238
- .length > 1) {
206
+ .length > 1 &&
207
+ (declarationWarnings ||
208
+ discovered.some((dc) => !dc.file.isDeclarationFile))) {
239
209
  logger.warn(logger.i18n.symbol_0_has_multiple_declarations_with_comment(symbol.name));
240
210
  const locations = discovered.map(({ file, ranges: [{ pos }] }) => {
241
- const path = (0, paths_1.nicePath)(file.fileName);
242
- const line = typescript_1.default.getLineAndCharacterOfPosition(file, pos).line +
211
+ const path = nicePath(file.fileName);
212
+ const line = ts.getLineAndCharacterOfPosition(file, pos).line +
243
213
  1;
244
214
  return `${path}:${line}`;
245
215
  });
@@ -249,16 +219,16 @@ function discoverComment(symbol, kind, logger, commentStyle, checker) {
249
219
  }
250
220
  }
251
221
  }
252
- function discoverSignatureComment(declaration, checker, commentStyle) {
222
+ export function discoverSignatureComment(declaration, checker, commentStyle) {
253
223
  for (const { node, inheritedFromParentDeclaration, } of declarationToCommentNodes(declaration, checker)) {
254
- if (typescript_1.default.isJSDocSignature(node)) {
224
+ if (ts.isJSDocSignature(node)) {
255
225
  const comment = node.parent.parent;
256
- (0, assert_1.ok)(typescript_1.default.isJSDoc(comment));
226
+ ok(ts.isJSDoc(comment));
257
227
  return {
258
228
  file: node.getSourceFile(),
259
229
  ranges: [
260
230
  {
261
- kind: typescript_1.default.SyntaxKind.MultiLineCommentTrivia,
231
+ kind: ts.SyntaxKind.MultiLineCommentTrivia,
262
232
  pos: comment.pos,
263
233
  end: comment.end,
264
234
  },
@@ -268,7 +238,7 @@ function discoverSignatureComment(declaration, checker, commentStyle) {
268
238
  };
269
239
  }
270
240
  const text = node.getSourceFile().text;
271
- const comments = collectCommentRanges(typescript_1.default.getLeadingCommentRanges(text, node.pos));
241
+ const comments = collectCommentRanges(ts.getLeadingCommentRanges(text, node.pos));
272
242
  comments.reverse();
273
243
  const comment = comments.find((ranges) => permittedRange(text, ranges, commentStyle));
274
244
  if (comment) {
@@ -282,15 +252,15 @@ function discoverSignatureComment(declaration, checker, commentStyle) {
282
252
  }
283
253
  }
284
254
  function findJsDocForComment(node, ranges) {
285
- if (ranges[0].kind === typescript_1.default.SyntaxKind.MultiLineCommentTrivia) {
286
- const jsDocs = typescript_1.default
255
+ if (ranges[0].kind === ts.SyntaxKind.MultiLineCommentTrivia) {
256
+ const jsDocs = ts
287
257
  .getJSDocCommentsAndTags(node)
288
- .map((doc) => typescript_1.default.findAncestor(doc, typescript_1.default.isJSDoc));
289
- if (typescript_1.default.isSourceFile(node)) {
258
+ .map((doc) => ts.findAncestor(doc, ts.isJSDoc));
259
+ if (ts.isSourceFile(node)) {
290
260
  if (node.statements.length) {
291
- jsDocs.push(...typescript_1.default
261
+ jsDocs.push(...ts
292
262
  .getJSDocCommentsAndTags(node.statements[0])
293
- .map((doc) => typescript_1.default.findAncestor(doc, typescript_1.default.isJSDoc)));
263
+ .map((doc) => ts.findAncestor(doc, ts.isJSDoc)));
294
264
  }
295
265
  }
296
266
  return jsDocs.find((doc) => doc.pos === ranges[0].pos);
@@ -310,7 +280,7 @@ function findJsDocForComment(node, ranges) {
310
280
  * @return TRUE if the given node is the topmost module declaration, FALSE otherwise.
311
281
  */
312
282
  function isTopmostModuleDeclaration(node) {
313
- return node.getChildren().some(typescript_1.default.isModuleBlock);
283
+ return node.getChildren().some(ts.isModuleBlock);
314
284
  }
315
285
  /**
316
286
  * Return the root module declaration of the given module declaration.
@@ -323,7 +293,7 @@ function isTopmostModuleDeclaration(node) {
323
293
  * ```
324
294
  */
325
295
  function getRootModuleDeclaration(node) {
326
- while (node.parent.kind === typescript_1.default.SyntaxKind.ModuleDeclaration) {
296
+ while (node.parent.kind === ts.SyntaxKind.ModuleDeclaration) {
327
297
  const parent = node.parent;
328
298
  if (node.name.pos === parent.name.end + 1) {
329
299
  node = parent;
@@ -340,17 +310,17 @@ function declarationToCommentNodeIgnoringParents(node) {
340
310
  return node;
341
311
  // function foo(x: number)
342
312
  // ^^^^^^^^^
343
- if (node.kind === typescript_1.default.SyntaxKind.Parameter) {
313
+ if (node.kind === ts.SyntaxKind.Parameter) {
344
314
  return node;
345
315
  }
346
316
  // const abc = 123
347
317
  // ^^^
348
- if (node.parent.kind === typescript_1.default.SyntaxKind.VariableDeclarationList) {
318
+ if (node.parent.kind === ts.SyntaxKind.VariableDeclarationList) {
349
319
  return node.parent.parent;
350
320
  }
351
321
  // const a = () => {}
352
322
  // ^^^^^^^^
353
- if (node.parent.kind === typescript_1.default.SyntaxKind.VariableDeclaration) {
323
+ if (node.parent.kind === ts.SyntaxKind.VariableDeclaration) {
354
324
  return node.parent.parent.parent;
355
325
  }
356
326
  // class X { y = () => {} }
@@ -361,13 +331,13 @@ function declarationToCommentNodeIgnoringParents(node) {
361
331
  // export default () => {}
362
332
  // ^^^^^^^^
363
333
  if ([
364
- typescript_1.default.SyntaxKind.PropertyDeclaration,
365
- typescript_1.default.SyntaxKind.BinaryExpression,
366
- typescript_1.default.SyntaxKind.ExportAssignment,
334
+ ts.SyntaxKind.PropertyDeclaration,
335
+ ts.SyntaxKind.BinaryExpression,
336
+ ts.SyntaxKind.ExportAssignment,
367
337
  ].includes(node.parent.kind)) {
368
338
  return node.parent;
369
339
  }
370
- if (typescript_1.default.isModuleDeclaration(node)) {
340
+ if (ts.isModuleDeclaration(node)) {
371
341
  if (!isTopmostModuleDeclaration(node)) {
372
342
  return;
373
343
  }
@@ -375,10 +345,10 @@ function declarationToCommentNodeIgnoringParents(node) {
375
345
  return getRootModuleDeclaration(node);
376
346
  }
377
347
  }
378
- if (node.kind === typescript_1.default.SyntaxKind.ExportSpecifier) {
348
+ if (node.kind === ts.SyntaxKind.ExportSpecifier) {
379
349
  return node.parent.parent;
380
350
  }
381
- if (typescript_1.default.SyntaxKind.NamespaceExport === node.kind) {
351
+ if (ts.SyntaxKind.NamespaceExport === node.kind) {
382
352
  return node.parent;
383
353
  }
384
354
  }
@@ -399,13 +369,13 @@ function declarationToCommentNodes(node, checker) {
399
369
  },
400
370
  ];
401
371
  let overloadIndex = undefined;
402
- if (typescript_1.default.isMethodDeclaration(node)) {
372
+ if (ts.isMethodDeclaration(node)) {
403
373
  const symbol = checker.getSymbolAtLocation(node.name || node);
404
374
  if (symbol) {
405
375
  overloadIndex = symbol.declarations
406
376
  ?.filter((d) => d.kind === node.kind)
407
377
  .indexOf(node);
408
- (0, assert_1.default)(overloadIndex !== -1, "Should always find declaration");
378
+ ok(overloadIndex !== -1, "Should always find declaration");
409
379
  }
410
380
  }
411
381
  const seenSymbols = new Set();
@@ -430,17 +400,29 @@ function declarationToCommentNodes(node, checker) {
430
400
  inheritedFromParentDeclaration: true,
431
401
  });
432
402
  }
403
+ // With overloaded functions/methods, TypeScript will use the comment on the first signature
404
+ // declaration
405
+ if ((ts.isFunctionDeclaration(node) || ts.isMethodDeclaration(node)) &&
406
+ node.name) {
407
+ const symbol = checker.getSymbolAtLocation(node.name);
408
+ if (symbol && symbol.declarations[0] !== node) {
409
+ result.push({
410
+ node: symbol.declarations[0],
411
+ inheritedFromParentDeclaration: true,
412
+ });
413
+ }
414
+ }
433
415
  return result;
434
416
  }
435
417
  // Lifted from the TS source, with a couple minor modifications
436
418
  function findBaseOfDeclaration(checker, declaration, cb) {
437
- const classOrInterfaceDeclaration = declaration.parent?.kind === typescript_1.default.SyntaxKind.Constructor
419
+ const classOrInterfaceDeclaration = declaration.parent?.kind === ts.SyntaxKind.Constructor
438
420
  ? declaration.parent.parent
439
421
  : declaration.parent;
440
422
  if (!classOrInterfaceDeclaration)
441
423
  return;
442
- const isStaticMember = typescript_1.default.getCombinedModifierFlags(declaration) & typescript_1.default.ModifierFlags.Static;
443
- return (0, array_1.firstDefined)(typescript_1.default.getAllSuperTypeNodes(classOrInterfaceDeclaration), (superTypeNode) => {
424
+ const isStaticMember = ts.getCombinedModifierFlags(declaration) & ts.ModifierFlags.Static;
425
+ return firstDefined(ts.getAllSuperTypeNodes(classOrInterfaceDeclaration), (superTypeNode) => {
444
426
  const baseType = checker.getTypeAtLocation(superTypeNode);
445
427
  const type = isStaticMember && baseType.symbol
446
428
  ? checker.getTypeOfSymbol(baseType.symbol)
@@ -459,19 +441,19 @@ function collectCommentRanges(ranges) {
459
441
  for (const range of ranges || []) {
460
442
  collect.push(range);
461
443
  switch (range.kind) {
462
- case typescript_1.default.SyntaxKind.MultiLineCommentTrivia:
444
+ case ts.SyntaxKind.MultiLineCommentTrivia:
463
445
  if (collect.length) {
464
446
  result.push(collect);
465
447
  collect = [];
466
448
  }
467
449
  result.push([range]);
468
450
  break;
469
- case typescript_1.default.SyntaxKind.SingleLineCommentTrivia:
451
+ case ts.SyntaxKind.SingleLineCommentTrivia:
470
452
  collect.push(range);
471
453
  break;
472
454
  /* istanbul ignore next */
473
455
  default:
474
- (0, utils_1.assertNever)(range.kind);
456
+ assertNever(range.kind);
475
457
  }
476
458
  }
477
459
  if (collect.length) {
@@ -481,14 +463,14 @@ function collectCommentRanges(ranges) {
481
463
  }
482
464
  function permittedRange(text, ranges, commentStyle) {
483
465
  switch (commentStyle) {
484
- case declaration_1.CommentStyle.All:
466
+ case CommentStyle.All:
485
467
  return true;
486
- case declaration_1.CommentStyle.Block:
487
- return ranges[0].kind === typescript_1.default.SyntaxKind.MultiLineCommentTrivia;
488
- case declaration_1.CommentStyle.Line:
489
- return ranges[0].kind === typescript_1.default.SyntaxKind.SingleLineCommentTrivia;
490
- case declaration_1.CommentStyle.JSDoc:
491
- return (ranges[0].kind === typescript_1.default.SyntaxKind.MultiLineCommentTrivia &&
468
+ case CommentStyle.Block:
469
+ return ranges[0].kind === ts.SyntaxKind.MultiLineCommentTrivia;
470
+ case CommentStyle.Line:
471
+ return ranges[0].kind === ts.SyntaxKind.SingleLineCommentTrivia;
472
+ case CommentStyle.JSDoc:
473
+ return (ranges[0].kind === ts.SyntaxKind.MultiLineCommentTrivia &&
492
474
  text[ranges[0].pos] === "/" &&
493
475
  text[ranges[0].pos + 1] === "*" &&
494
476
  text[ranges[0].pos + 2] === "*");
@@ -1,8 +1,8 @@
1
1
  import ts from "typescript";
2
- import { Comment, ReflectionKind } from "../../models";
3
- import { type Logger } from "../../utils";
4
- import type { CommentStyle, JsDocCompatibility } from "../../utils/options/declaration";
5
- import type { FileRegistry } from "../../models/FileRegistry";
2
+ import { Comment, ReflectionKind } from "../../models/index.js";
3
+ import { type Logger } from "../../utils/index.js";
4
+ import type { CommentStyle, JsDocCompatibility } from "../../utils/options/declaration.js";
5
+ import type { FileRegistry } from "../../models/FileRegistry.js";
6
6
  export interface CommentParserConfig {
7
7
  blockTags: Set<string>;
8
8
  inlineTags: Set<string>;