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,49 +1,23 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.UnknownType = exports.UnionType = exports.TypeOperatorType = exports.NamedTupleMember = exports.TupleType = exports.TemplateLiteralType = exports.RestType = exports.ReflectionType = exports.ReferenceType = exports.QueryType = exports.PredicateType = exports.OptionalType = exports.MappedType = exports.LiteralType = exports.IntrinsicType = exports.IntersectionType = exports.InferredType = exports.IndexedAccessType = exports.ConditionalType = exports.ArrayType = exports.TypeContext = exports.Type = void 0;
27
- exports.makeRecursiveVisitor = makeRecursiveVisitor;
28
- const ts = __importStar(require("typescript"));
29
- const tsutils_1 = require("../utils/tsutils");
30
- const ReflectionSymbolId_1 = require("./reflections/ReflectionSymbolId");
31
- const fs_1 = require("../utils/fs");
32
- const kind_1 = require("./reflections/kind");
33
- const comments_1 = require("./comments");
1
+ import * as ts from "typescript";
2
+ import { getQualifiedName } from "../utils/tsutils.js";
3
+ import { ReflectionSymbolId } from "./reflections/ReflectionSymbolId.js";
4
+ import { findPackageForPath } from "../utils/fs.js";
5
+ import { ReflectionKind } from "./reflections/kind.js";
6
+ import { Comment } from "./comments/index.js";
7
+ import { joinArray } from "../utils/array.js";
34
8
  /**
35
9
  * Base class of all type definitions.
36
10
  * @category Types
37
11
  */
38
- class Type {
12
+ export class Type {
39
13
  /**
40
14
  * Return a string representation of this type.
41
15
  */
42
16
  toString() {
43
- return this.stringify(exports.TypeContext.none);
17
+ return this.stringify(TypeContext.none);
44
18
  }
45
- visit(visitor) {
46
- return visitor[this.type]?.(this);
19
+ visit(visitor, ...args) {
20
+ return visitor[this.type]?.(this, ...args);
47
21
  }
48
22
  stringify(context) {
49
23
  if (this.needsParenthesis(context)) {
@@ -53,9 +27,14 @@ class Type {
53
27
  }
54
28
  // Nothing to do for the majority of types.
55
29
  fromObject(_de, _obj) { }
30
+ /**
31
+ * Return the estimated size of the type if it was all printed on one line.
32
+ */
33
+ estimatePrintWidth() {
34
+ return this.getTypeString().length;
35
+ }
56
36
  }
57
- exports.Type = Type;
58
- function makeRecursiveVisitor(visitor) {
37
+ export function makeRecursiveVisitor(visitor) {
59
38
  const recursiveVisitor = {
60
39
  namedTupleMember(type) {
61
40
  visitor.namedTupleMember?.(type);
@@ -151,7 +130,7 @@ function makeRecursiveVisitor(visitor) {
151
130
  * Used by TypeDoc internally to track when to output parenthesis when rendering.
152
131
  * @enum
153
132
  */
154
- exports.TypeContext = {
133
+ export const TypeContext = {
155
134
  none: "none",
156
135
  templateLiteralElement: "templateLiteralElement", // `${here}`
157
136
  arrayElement: "arrayElement", // here[]
@@ -184,17 +163,18 @@ exports.TypeContext = {
184
163
  * ```
185
164
  * @category Types
186
165
  */
187
- class ArrayType extends Type {
166
+ export class ArrayType extends Type {
167
+ elementType;
168
+ type = "array";
188
169
  /**
189
170
  * @param elementType The type of the elements in the array.
190
171
  */
191
172
  constructor(elementType) {
192
173
  super();
193
174
  this.elementType = elementType;
194
- this.type = "array";
195
175
  }
196
176
  getTypeString() {
197
- return this.elementType.stringify(exports.TypeContext.arrayElement) + "[]";
177
+ return this.elementType.stringify(TypeContext.arrayElement) + "[]";
198
178
  }
199
179
  needsParenthesis() {
200
180
  return false;
@@ -206,7 +186,6 @@ class ArrayType extends Type {
206
186
  };
207
187
  }
208
188
  }
209
- exports.ArrayType = ArrayType;
210
189
  /**
211
190
  * Represents a conditional type.
212
191
  *
@@ -215,24 +194,28 @@ exports.ArrayType = ArrayType;
215
194
  * ```
216
195
  * @category Types
217
196
  */
218
- class ConditionalType extends Type {
197
+ export class ConditionalType extends Type {
198
+ checkType;
199
+ extendsType;
200
+ trueType;
201
+ falseType;
202
+ type = "conditional";
219
203
  constructor(checkType, extendsType, trueType, falseType) {
220
204
  super();
221
205
  this.checkType = checkType;
222
206
  this.extendsType = extendsType;
223
207
  this.trueType = trueType;
224
208
  this.falseType = falseType;
225
- this.type = "conditional";
226
209
  }
227
210
  getTypeString() {
228
211
  return [
229
- this.checkType.stringify(exports.TypeContext.conditionalCheck),
212
+ this.checkType.stringify(TypeContext.conditionalCheck),
230
213
  "extends",
231
- this.extendsType.stringify(exports.TypeContext.conditionalExtends),
214
+ this.extendsType.stringify(TypeContext.conditionalExtends),
232
215
  "?",
233
- this.trueType.stringify(exports.TypeContext.conditionalTrue),
216
+ this.trueType.stringify(TypeContext.conditionalTrue),
234
217
  ":",
235
- this.falseType.stringify(exports.TypeContext.conditionalFalse),
218
+ this.falseType.stringify(TypeContext.conditionalFalse),
236
219
  ].join(" ");
237
220
  }
238
221
  needsParenthesis(context) {
@@ -273,23 +256,24 @@ class ConditionalType extends Type {
273
256
  };
274
257
  }
275
258
  }
276
- exports.ConditionalType = ConditionalType;
277
259
  /**
278
260
  * Represents an indexed access type.
279
261
  * @category Types
280
262
  */
281
- class IndexedAccessType extends Type {
263
+ export class IndexedAccessType extends Type {
264
+ objectType;
265
+ indexType;
266
+ type = "indexedAccess";
282
267
  constructor(objectType, indexType) {
283
268
  super();
284
269
  this.objectType = objectType;
285
270
  this.indexType = indexType;
286
- this.type = "indexedAccess";
287
271
  }
288
272
  getTypeString() {
289
273
  return [
290
- this.objectType.stringify(exports.TypeContext.indexedObject),
274
+ this.objectType.stringify(TypeContext.indexedObject),
291
275
  "[",
292
- this.indexType.stringify(exports.TypeContext.indexedIndex),
276
+ this.indexType.stringify(TypeContext.indexedIndex),
293
277
  "]",
294
278
  ].join("");
295
279
  }
@@ -304,7 +288,6 @@ class IndexedAccessType extends Type {
304
288
  };
305
289
  }
306
290
  }
307
- exports.IndexedAccessType = IndexedAccessType;
308
291
  /**
309
292
  * Represents an inferred type, U in the example below.
310
293
  *
@@ -313,16 +296,18 @@ exports.IndexedAccessType = IndexedAccessType;
313
296
  * ```
314
297
  * @category Types
315
298
  */
316
- class InferredType extends Type {
299
+ export class InferredType extends Type {
300
+ name;
301
+ constraint;
302
+ type = "inferred";
317
303
  constructor(name, constraint) {
318
304
  super();
319
305
  this.name = name;
320
306
  this.constraint = constraint;
321
- this.type = "inferred";
322
307
  }
323
308
  getTypeString() {
324
309
  if (this.constraint) {
325
- return `infer ${this.name} extends ${this.constraint.stringify(exports.TypeContext.inferredConstraint)}`;
310
+ return `infer ${this.name} extends ${this.constraint.stringify(TypeContext.inferredConstraint)}`;
326
311
  }
327
312
  return `infer ${this.name}`;
328
313
  }
@@ -362,7 +347,6 @@ class InferredType extends Type {
362
347
  };
363
348
  }
364
349
  }
365
- exports.InferredType = InferredType;
366
350
  /**
367
351
  * Represents an intersection type.
368
352
  *
@@ -371,15 +355,16 @@ exports.InferredType = InferredType;
371
355
  * ```
372
356
  * @category Types
373
357
  */
374
- class IntersectionType extends Type {
358
+ export class IntersectionType extends Type {
359
+ types;
360
+ type = "intersection";
375
361
  constructor(types) {
376
362
  super();
377
363
  this.types = types;
378
- this.type = "intersection";
379
364
  }
380
365
  getTypeString() {
381
366
  return this.types
382
- .map((t) => t.stringify(exports.TypeContext.intersectionElement))
367
+ .map((t) => t.stringify(TypeContext.intersectionElement))
383
368
  .join(" & ");
384
369
  }
385
370
  needsParenthesis(context) {
@@ -417,7 +402,6 @@ class IntersectionType extends Type {
417
402
  };
418
403
  }
419
404
  }
420
- exports.IntersectionType = IntersectionType;
421
405
  /**
422
406
  * Represents an intrinsic type like `string` or `boolean`.
423
407
  *
@@ -426,11 +410,12 @@ exports.IntersectionType = IntersectionType;
426
410
  * ```
427
411
  * @category Types
428
412
  */
429
- class IntrinsicType extends Type {
413
+ export class IntrinsicType extends Type {
414
+ name;
415
+ type = "intrinsic";
430
416
  constructor(name) {
431
417
  super();
432
418
  this.name = name;
433
- this.type = "intrinsic";
434
419
  }
435
420
  getTypeString() {
436
421
  return this.name;
@@ -445,7 +430,6 @@ class IntrinsicType extends Type {
445
430
  return false;
446
431
  }
447
432
  }
448
- exports.IntrinsicType = IntrinsicType;
449
433
  /**
450
434
  * Represents a literal type.
451
435
  *
@@ -455,11 +439,12 @@ exports.IntrinsicType = IntrinsicType;
455
439
  * ```
456
440
  * @category Types
457
441
  */
458
- class LiteralType extends Type {
442
+ export class LiteralType extends Type {
443
+ value;
444
+ type = "literal";
459
445
  constructor(value) {
460
446
  super();
461
447
  this.value = value;
462
- this.type = "literal";
463
448
  }
464
449
  /**
465
450
  * Return a string representation of this type.
@@ -489,7 +474,6 @@ class LiteralType extends Type {
489
474
  };
490
475
  }
491
476
  }
492
- exports.LiteralType = LiteralType;
493
477
  /**
494
478
  * Represents a mapped type.
495
479
  *
@@ -498,7 +482,14 @@ exports.LiteralType = LiteralType;
498
482
  * ```
499
483
  * @category Types
500
484
  */
501
- class MappedType extends Type {
485
+ export class MappedType extends Type {
486
+ parameter;
487
+ parameterType;
488
+ templateType;
489
+ readonlyModifier;
490
+ optionalModifier;
491
+ nameType;
492
+ type = "mapped";
502
493
  constructor(parameter, parameterType, templateType, readonlyModifier, optionalModifier, nameType) {
503
494
  super();
504
495
  this.parameter = parameter;
@@ -507,7 +498,6 @@ class MappedType extends Type {
507
498
  this.readonlyModifier = readonlyModifier;
508
499
  this.optionalModifier = optionalModifier;
509
500
  this.nameType = nameType;
510
- this.type = "mapped";
511
501
  }
512
502
  getTypeString() {
513
503
  const read = {
@@ -526,12 +516,12 @@ class MappedType extends Type {
526
516
  "[",
527
517
  this.parameter,
528
518
  " in ",
529
- this.parameterType.stringify(exports.TypeContext.mappedParameter),
519
+ this.parameterType.stringify(TypeContext.mappedParameter),
530
520
  ];
531
521
  if (this.nameType) {
532
- parts.push(" as ", this.nameType.stringify(exports.TypeContext.mappedName));
522
+ parts.push(" as ", this.nameType.stringify(TypeContext.mappedName));
533
523
  }
534
- parts.push("]", opt, ": ", this.templateType.stringify(exports.TypeContext.mappedTemplate), " }");
524
+ parts.push("]", opt, ": ", this.templateType.stringify(TypeContext.mappedTemplate), " }");
535
525
  return parts.join("");
536
526
  }
537
527
  needsParenthesis() {
@@ -549,7 +539,6 @@ class MappedType extends Type {
549
539
  };
550
540
  }
551
541
  }
552
- exports.MappedType = MappedType;
553
542
  /**
554
543
  * Represents an optional type
555
544
  * ```ts
@@ -558,14 +547,15 @@ exports.MappedType = MappedType;
558
547
  * ```
559
548
  * @category Types
560
549
  */
561
- class OptionalType extends Type {
550
+ export class OptionalType extends Type {
551
+ elementType;
552
+ type = "optional";
562
553
  constructor(elementType) {
563
554
  super();
564
555
  this.elementType = elementType;
565
- this.type = "optional";
566
556
  }
567
557
  getTypeString() {
568
- return this.elementType.stringify(exports.TypeContext.optionalElement) + "?";
558
+ return this.elementType.stringify(TypeContext.optionalElement) + "?";
569
559
  }
570
560
  needsParenthesis() {
571
561
  return false;
@@ -577,7 +567,6 @@ class OptionalType extends Type {
577
567
  };
578
568
  }
579
569
  }
580
- exports.OptionalType = OptionalType;
581
570
  /**
582
571
  * Represents a type predicate.
583
572
  *
@@ -587,7 +576,11 @@ exports.OptionalType = OptionalType;
587
576
  * ```
588
577
  * @category Types
589
578
  */
590
- class PredicateType extends Type {
579
+ export class PredicateType extends Type {
580
+ name;
581
+ asserts;
582
+ targetType;
583
+ type = "predicate";
591
584
  /**
592
585
  * Create a new PredicateType instance.
593
586
  *
@@ -603,7 +596,6 @@ class PredicateType extends Type {
603
596
  this.name = name;
604
597
  this.asserts = asserts;
605
598
  this.targetType = targetType;
606
- this.type = "predicate";
607
599
  }
608
600
  /**
609
601
  * Return a string representation of this type.
@@ -611,7 +603,7 @@ class PredicateType extends Type {
611
603
  getTypeString() {
612
604
  const out = this.asserts ? ["asserts", this.name] : [this.name];
613
605
  if (this.targetType) {
614
- out.push("is", this.targetType.stringify(exports.TypeContext.predicateTarget));
606
+ out.push("is", this.targetType.stringify(TypeContext.predicateTarget));
615
607
  }
616
608
  return out.join(" ");
617
609
  }
@@ -627,7 +619,6 @@ class PredicateType extends Type {
627
619
  };
628
620
  }
629
621
  }
630
- exports.PredicateType = PredicateType;
631
622
  /**
632
623
  * Represents a type that is constructed by querying the type of a reflection.
633
624
  * ```ts
@@ -636,14 +627,15 @@ exports.PredicateType = PredicateType;
636
627
  * ```
637
628
  * @category Types
638
629
  */
639
- class QueryType extends Type {
630
+ export class QueryType extends Type {
631
+ queryType;
632
+ type = "query";
640
633
  constructor(queryType) {
641
634
  super();
642
635
  this.queryType = queryType;
643
- this.type = "query";
644
636
  }
645
637
  getTypeString() {
646
- return `typeof ${this.queryType.stringify(exports.TypeContext.queryTypeTarget)}`;
638
+ return `typeof ${this.queryType.stringify(TypeContext.queryTypeTarget)}`;
647
639
  }
648
640
  /**
649
641
  * @privateRemarks
@@ -661,7 +653,6 @@ class QueryType extends Type {
661
653
  };
662
654
  }
663
655
  }
664
- exports.QueryType = QueryType;
665
656
  /**
666
657
  * Represents a type that refers to another reflection like a class, interface or enum.
667
658
  *
@@ -670,7 +661,19 @@ exports.QueryType = QueryType;
670
661
  * ```
671
662
  * @category Types
672
663
  */
673
- class ReferenceType extends Type {
664
+ export class ReferenceType extends Type {
665
+ type = "reference";
666
+ /**
667
+ * The name of the referenced type.
668
+ *
669
+ * If the symbol cannot be found because it's not part of the documentation this
670
+ * can be used to represent the type.
671
+ */
672
+ name;
673
+ /**
674
+ * The type arguments of this reference.
675
+ */
676
+ typeArguments;
674
677
  /**
675
678
  * The resolved reflection.
676
679
  */
@@ -683,13 +686,22 @@ class ReferenceType extends Type {
683
686
  return;
684
687
  }
685
688
  const kind = this.preferValues
686
- ? kind_1.ReflectionKind.ValueReferenceTarget
687
- : kind_1.ReflectionKind.TypeReferenceTarget;
689
+ ? ReflectionKind.ValueReferenceTarget
690
+ : ReflectionKind.TypeReferenceTarget;
688
691
  const resolved = resolvePotential.find((refl) => refl.kindOf(kind)) ||
689
692
  resolvePotential.find((refl) => refl.kindOf(~kind));
690
693
  this._target = resolved.id;
691
694
  return resolved;
692
695
  }
696
+ /**
697
+ * Sometimes a few properties are more important than the rest
698
+ * of the properties within a type. This occurs most often with
699
+ * object parameters, where users want to specify `@param foo.bar`
700
+ * to highlight something about the `bar` property.
701
+ *
702
+ * Does NOT support nested properties.
703
+ */
704
+ highlightedProperties;
693
705
  /**
694
706
  * If not resolved, the symbol id of the reflection, otherwise undefined.
695
707
  */
@@ -703,6 +715,10 @@ class ReferenceType extends Type {
703
715
  * to a reflection. This happens for type parameters and when representing a mapped type.
704
716
  */
705
717
  isIntentionallyBroken() {
718
+ if (typeof this._target === "object" &&
719
+ this._project?.symbolIdHasBeenRemoved(this._target)) {
720
+ return true;
721
+ }
706
722
  return this._target === -1 || this.refersToTypeParameter;
707
723
  }
708
724
  /**
@@ -719,20 +735,35 @@ class ReferenceType extends Type {
719
735
  },
720
736
  };
721
737
  }
738
+ /**
739
+ * The fully qualified name of the referenced type, relative to the file it is defined in.
740
+ * This will usually be the same as `name`, unless namespaces are used.
741
+ */
742
+ qualifiedName;
743
+ /**
744
+ * The package that this type is referencing.
745
+ */
746
+ package;
747
+ /**
748
+ * If this reference type refers to a reflection defined by a project not being rendered,
749
+ * points to the url that this type should be linked to.
750
+ */
751
+ externalUrl;
752
+ /**
753
+ * If set, no warnings about something not being exported should be created
754
+ * since this may be referring to a type created with `infer X` which will not
755
+ * be registered on the project.
756
+ */
757
+ refersToTypeParameter = false;
758
+ /**
759
+ * If set, will prefer reflections with {@link ReflectionKind | ReflectionKinds} which represent
760
+ * values rather than those which represent types.
761
+ */
762
+ preferValues = false;
763
+ _target;
764
+ _project;
722
765
  constructor(name, target, project, qualifiedName) {
723
766
  super();
724
- this.type = "reference";
725
- /**
726
- * If set, no warnings about something not being exported should be created
727
- * since this may be referring to a type created with `infer X` which will not
728
- * be registered on the project.
729
- */
730
- this.refersToTypeParameter = false;
731
- /**
732
- * If set, will prefer reflections with {@link ReflectionKind | ReflectionKinds} which represent
733
- * values rather than those which represent types.
734
- */
735
- this.preferValues = false;
736
767
  this.name = name;
737
768
  if (typeof target === "number") {
738
769
  this._target = target;
@@ -747,14 +778,14 @@ class ReferenceType extends Type {
747
778
  return new ReferenceType(name, target, project, name);
748
779
  }
749
780
  static createSymbolReference(symbol, context, name) {
750
- const ref = new ReferenceType(name ?? symbol.name, new ReflectionSymbolId_1.ReflectionSymbolId(symbol), context.project, (0, tsutils_1.getQualifiedName)(symbol, name ?? symbol.name));
781
+ const ref = new ReferenceType(name ?? symbol.name, new ReflectionSymbolId(symbol), context.project, getQualifiedName(symbol, name ?? symbol.name));
751
782
  ref.refersToTypeParameter = !!(symbol.flags & ts.SymbolFlags.TypeParameter);
752
783
  const symbolPath = symbol.declarations?.[0]
753
784
  ?.getSourceFile()
754
785
  .fileName.replace(/\\/g, "/");
755
786
  if (!symbolPath)
756
787
  return ref;
757
- ref.package = (0, fs_1.findPackageForPath)(symbolPath);
788
+ ref.package = findPackageForPath(symbolPath);
758
789
  return ref;
759
790
  }
760
791
  /**
@@ -772,7 +803,7 @@ class ReferenceType extends Type {
772
803
  if (this.typeArguments && this.typeArguments.length > 0) {
773
804
  typeArgs += "<";
774
805
  typeArgs += this.typeArguments
775
- .map((arg) => arg.stringify(exports.TypeContext.referenceTypeArgument))
806
+ .map((arg) => arg.stringify(TypeContext.referenceTypeArgument))
776
807
  .join(", ");
777
808
  typeArgs += ">";
778
809
  }
@@ -782,11 +813,19 @@ class ReferenceType extends Type {
782
813
  return false;
783
814
  }
784
815
  toObject(serializer) {
816
+ let target;
817
+ if (typeof this._target === "number") {
818
+ target = this._target;
819
+ }
820
+ else if (this._project?.symbolIdHasBeenRemoved(this._target)) {
821
+ target = -1;
822
+ }
823
+ else {
824
+ target = this._target.toObject(serializer);
825
+ }
785
826
  const result = {
786
827
  type: this.type,
787
- target: typeof this._target === "number"
788
- ? this._target
789
- : this._target.toObject(serializer),
828
+ target,
790
829
  typeArguments: serializer.toObjectsOptional(this.typeArguments),
791
830
  name: this.name,
792
831
  package: this.package,
@@ -801,6 +840,14 @@ class ReferenceType extends Type {
801
840
  if (typeof this._target !== "number" && this.preferValues) {
802
841
  result.preferValues = true;
803
842
  }
843
+ if (this.highlightedProperties) {
844
+ result.highlightedProperties = Object.fromEntries(Array.from(this.highlightedProperties.entries(), ([key, parts]) => {
845
+ return [
846
+ key,
847
+ Comment.serializeDisplayParts(serializer, parts),
848
+ ];
849
+ }));
850
+ }
804
851
  return result;
805
852
  }
806
853
  fromObject(de, obj) {
@@ -822,15 +869,20 @@ class ReferenceType extends Type {
822
869
  }
823
870
  else {
824
871
  this._project = de.project;
825
- this._target = new ReflectionSymbolId_1.ReflectionSymbolId(obj.target);
872
+ this._target = new ReflectionSymbolId(obj.target);
826
873
  }
827
874
  this.qualifiedName = obj.qualifiedName ?? obj.name;
828
875
  this.package = obj.package;
829
876
  this.refersToTypeParameter = !!obj.refersToTypeParameter;
830
877
  this.preferValues = !!obj.preferValues;
878
+ if (obj.highlightedProperties) {
879
+ this.highlightedProperties = new Map();
880
+ for (const [key, parts] of Object.entries(obj.highlightedProperties)) {
881
+ this.highlightedProperties.set(key, Comment.deserializeDisplayParts(de, parts));
882
+ }
883
+ }
831
884
  }
832
885
  }
833
- exports.ReferenceType = ReferenceType;
834
886
  /**
835
887
  * Represents a type which has it's own reflection like literal types.
836
888
  * This type will likely go away at some point and be replaced by a dedicated
@@ -842,22 +894,32 @@ exports.ReferenceType = ReferenceType;
842
894
  * ```
843
895
  * @category Types
844
896
  */
845
- class ReflectionType extends Type {
897
+ export class ReflectionType extends Type {
898
+ declaration;
899
+ type = "reflection";
846
900
  constructor(declaration) {
847
901
  super();
848
902
  this.declaration = declaration;
849
- this.type = "reflection";
850
903
  }
851
- // This really ought to do better, but I'm putting off investing effort here until
852
- // I'm fully convinced that keeping this is a good idea. Currently, I'd much rather
853
- // change object types to not create reflections.
854
904
  getTypeString() {
855
- if (!this.declaration.children && this.declaration.signatures) {
856
- return "Function";
905
+ const parts = [];
906
+ const sigs = this.declaration.getAllSignatures();
907
+ for (const sig of sigs) {
908
+ parts.push(sigStr(sig, ": "));
857
909
  }
858
- else {
859
- return "Object";
910
+ if (this.declaration.children) {
911
+ for (const p of this.declaration.children) {
912
+ parts.push(`${p.name}${propertySep(p)} ${typeStr(p.type)}`);
913
+ }
914
+ return `{ ${parts.join("; ")} }`;
860
915
  }
916
+ if (sigs.length === 1) {
917
+ return sigStr(sigs[0], " => ");
918
+ }
919
+ if (parts.length === 0) {
920
+ return "{}";
921
+ }
922
+ return `{ ${parts.join("; ")} }`;
861
923
  }
862
924
  needsParenthesis() {
863
925
  return false;
@@ -869,7 +931,6 @@ class ReflectionType extends Type {
869
931
  };
870
932
  }
871
933
  }
872
- exports.ReflectionType = ReflectionType;
873
934
  /**
874
935
  * Represents a rest type
875
936
  * ```ts
@@ -878,14 +939,15 @@ exports.ReflectionType = ReflectionType;
878
939
  * ```
879
940
  * @category Types
880
941
  */
881
- class RestType extends Type {
942
+ export class RestType extends Type {
943
+ elementType;
944
+ type = "rest";
882
945
  constructor(elementType) {
883
946
  super();
884
947
  this.elementType = elementType;
885
- this.type = "rest";
886
948
  }
887
949
  getTypeString() {
888
- return `...${this.elementType.stringify(exports.TypeContext.restElement)}`;
950
+ return `...${this.elementType.stringify(TypeContext.restElement)}`;
889
951
  }
890
952
  needsParenthesis() {
891
953
  return false;
@@ -897,7 +959,6 @@ class RestType extends Type {
897
959
  };
898
960
  }
899
961
  }
900
- exports.RestType = RestType;
901
962
  /**
902
963
  * TS 4.1 template literal types
903
964
  * ```ts
@@ -905,12 +966,14 @@ exports.RestType = RestType;
905
966
  * ```
906
967
  * @category Types
907
968
  */
908
- class TemplateLiteralType extends Type {
969
+ export class TemplateLiteralType extends Type {
970
+ head;
971
+ tail;
972
+ type = "templateLiteral";
909
973
  constructor(head, tail) {
910
974
  super();
911
975
  this.head = head;
912
976
  this.tail = tail;
913
- this.type = "templateLiteral";
914
977
  }
915
978
  getTypeString() {
916
979
  return [
@@ -918,7 +981,7 @@ class TemplateLiteralType extends Type {
918
981
  this.head,
919
982
  ...this.tail.map(([type, text]) => {
920
983
  return ("${" +
921
- type.stringify(exports.TypeContext.templateLiteralElement) +
984
+ type.stringify(TypeContext.templateLiteralElement) +
922
985
  "}" +
923
986
  text);
924
987
  }),
@@ -939,7 +1002,6 @@ class TemplateLiteralType extends Type {
939
1002
  };
940
1003
  }
941
1004
  }
942
- exports.TemplateLiteralType = TemplateLiteralType;
943
1005
  /**
944
1006
  * Represents a tuple type.
945
1007
  *
@@ -948,19 +1010,20 @@ exports.TemplateLiteralType = TemplateLiteralType;
948
1010
  * ```
949
1011
  * @category Types
950
1012
  */
951
- class TupleType extends Type {
1013
+ export class TupleType extends Type {
1014
+ elements;
1015
+ type = "tuple";
952
1016
  /**
953
1017
  * @param elements The ordered type elements of the tuple type.
954
1018
  */
955
1019
  constructor(elements) {
956
1020
  super();
957
1021
  this.elements = elements;
958
- this.type = "tuple";
959
1022
  }
960
1023
  getTypeString() {
961
1024
  return ("[" +
962
1025
  this.elements
963
- .map((t) => t.stringify(exports.TypeContext.tupleElement))
1026
+ .map((t) => t.stringify(TypeContext.tupleElement))
964
1027
  .join(", ") +
965
1028
  "]");
966
1029
  }
@@ -974,7 +1037,6 @@ class TupleType extends Type {
974
1037
  };
975
1038
  }
976
1039
  }
977
- exports.TupleType = TupleType;
978
1040
  /**
979
1041
  * Represents a named member of a tuple type.
980
1042
  *
@@ -983,19 +1045,22 @@ exports.TupleType = TupleType;
983
1045
  * ```
984
1046
  * @category Types
985
1047
  */
986
- class NamedTupleMember extends Type {
1048
+ export class NamedTupleMember extends Type {
1049
+ name;
1050
+ isOptional;
1051
+ element;
1052
+ type = "namedTupleMember";
987
1053
  constructor(name, isOptional, element) {
988
1054
  super();
989
1055
  this.name = name;
990
1056
  this.isOptional = isOptional;
991
1057
  this.element = element;
992
- this.type = "namedTupleMember";
993
1058
  }
994
1059
  /**
995
1060
  * Return a string representation of this type.
996
1061
  */
997
1062
  getTypeString() {
998
- return `${this.name}${this.isOptional ? "?" : ""}: ${this.element.stringify(exports.TypeContext.tupleElement)}`;
1063
+ return `${this.name}${this.isOptional ? "?" : ""}: ${this.element.stringify(TypeContext.tupleElement)}`;
999
1064
  }
1000
1065
  needsParenthesis() {
1001
1066
  return false;
@@ -1009,7 +1074,6 @@ class NamedTupleMember extends Type {
1009
1074
  };
1010
1075
  }
1011
1076
  }
1012
- exports.NamedTupleMember = NamedTupleMember;
1013
1077
  /**
1014
1078
  * Represents a type operator type.
1015
1079
  *
@@ -1019,15 +1083,17 @@ exports.NamedTupleMember = NamedTupleMember;
1019
1083
  * ```
1020
1084
  * @category Types
1021
1085
  */
1022
- class TypeOperatorType extends Type {
1086
+ export class TypeOperatorType extends Type {
1087
+ target;
1088
+ operator;
1089
+ type = "typeOperator";
1023
1090
  constructor(target, operator) {
1024
1091
  super();
1025
1092
  this.target = target;
1026
1093
  this.operator = operator;
1027
- this.type = "typeOperator";
1028
1094
  }
1029
1095
  getTypeString() {
1030
- return `${this.operator} ${this.target.stringify(exports.TypeContext.typeOperatorTarget)}`;
1096
+ return `${this.operator} ${this.target.stringify(TypeContext.typeOperatorTarget)}`;
1031
1097
  }
1032
1098
  needsParenthesis(context) {
1033
1099
  const map = {
@@ -1065,7 +1131,6 @@ class TypeOperatorType extends Type {
1065
1131
  };
1066
1132
  }
1067
1133
  }
1068
- exports.TypeOperatorType = TypeOperatorType;
1069
1134
  /**
1070
1135
  * Represents an union type.
1071
1136
  *
@@ -1074,15 +1139,23 @@ exports.TypeOperatorType = TypeOperatorType;
1074
1139
  * ```
1075
1140
  * @category Types
1076
1141
  */
1077
- class UnionType extends Type {
1142
+ export class UnionType extends Type {
1143
+ types;
1144
+ type = "union";
1145
+ /**
1146
+ * If present, there should be as many items in this array as there are items in the {@link types} array.
1147
+ *
1148
+ * This member is only valid on unions which are on {@link DeclarationReflection.type | DeclarationReflection.type} with a
1149
+ * {@link ReflectionKind} `kind` of `TypeAlias`. Specifying it on any other union is undefined behavior.
1150
+ */
1151
+ elementSummaries;
1078
1152
  constructor(types) {
1079
1153
  super();
1080
1154
  this.types = types;
1081
- this.type = "union";
1082
1155
  }
1083
1156
  getTypeString() {
1084
1157
  return this.types
1085
- .map((t) => t.stringify(exports.TypeContext.unionElement))
1158
+ .map((t) => t.stringify(TypeContext.unionElement))
1086
1159
  .join(" | ");
1087
1160
  }
1088
1161
  needsParenthesis(context) {
@@ -1115,26 +1188,29 @@ class UnionType extends Type {
1115
1188
  }
1116
1189
  fromObject(de, obj) {
1117
1190
  if (obj.elementSummaries) {
1118
- this.elementSummaries = obj.elementSummaries.map((parts) => comments_1.Comment.deserializeDisplayParts(de, parts));
1191
+ this.elementSummaries = obj.elementSummaries.map((parts) => Comment.deserializeDisplayParts(de, parts));
1119
1192
  }
1120
1193
  }
1121
1194
  toObject(serializer) {
1122
1195
  return {
1123
1196
  type: this.type,
1124
1197
  types: this.types.map((t) => serializer.toObject(t)),
1125
- elementSummaries: this.elementSummaries?.map((parts) => comments_1.Comment.serializeDisplayParts(serializer, parts)),
1198
+ elementSummaries: this.elementSummaries?.map((parts) => Comment.serializeDisplayParts(serializer, parts)),
1126
1199
  };
1127
1200
  }
1128
1201
  }
1129
- exports.UnionType = UnionType;
1130
1202
  /**
1131
1203
  * Represents all unknown types that cannot be converted by TypeDoc.
1132
1204
  * @category Types
1133
1205
  */
1134
- class UnknownType extends Type {
1206
+ export class UnknownType extends Type {
1207
+ type = "unknown";
1208
+ /**
1209
+ * A string representation of the type as returned from TypeScript compiler.
1210
+ */
1211
+ name;
1135
1212
  constructor(name) {
1136
1213
  super();
1137
- this.type = "unknown";
1138
1214
  this.name = name;
1139
1215
  }
1140
1216
  getTypeString() {
@@ -1145,7 +1221,7 @@ class UnknownType extends Type {
1145
1221
  * to be extra safe.
1146
1222
  */
1147
1223
  needsParenthesis(context) {
1148
- return context !== exports.TypeContext.none;
1224
+ return context !== TypeContext.none;
1149
1225
  }
1150
1226
  toObject() {
1151
1227
  return {
@@ -1154,4 +1230,13 @@ class UnknownType extends Type {
1154
1230
  };
1155
1231
  }
1156
1232
  }
1157
- exports.UnknownType = UnknownType;
1233
+ function propertySep(refl) {
1234
+ return refl.flags.isOptional ? "?:" : ":";
1235
+ }
1236
+ function typeStr(type) {
1237
+ return type?.toString() ?? "any";
1238
+ }
1239
+ function sigStr(sig, sep) {
1240
+ const params = joinArray(sig.parameters, ", ", (p) => `${p.name}${propertySep(p)} ${typeStr(p.type)}`);
1241
+ return `(${params})${sep}${typeStr(sig.type)}`;
1242
+ }