typedoc 0.26.11 → 0.27.0-beta.0

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 (335) 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 +210 -238
  40. package/dist/lib/converter/factories/index-signature.d.ts +1 -1
  41. package/dist/lib/converter/factories/index-signature.js +11 -17
  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 +366 -2
  89. package/dist/lib/internationalization/locales/en.d.cts +339 -2
  90. package/dist/lib/internationalization/locales/jp.cjs +8 -11
  91. package/dist/lib/internationalization/locales/jp.d.cts +310 -1
  92. package/dist/lib/internationalization/locales/ko.cjs +7 -9
  93. package/dist/lib/internationalization/locales/ko.d.cts +223 -1
  94. package/dist/lib/internationalization/locales/zh.cjs +7 -10
  95. package/dist/lib/internationalization/locales/zh.d.cts +381 -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 +26 -13
  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 +619 -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 +13 -0
  154. package/dist/lib/output/output.js +72 -0
  155. package/dist/lib/output/plugins/AssetsPlugin.d.ts +7 -8
  156. package/dist/lib/output/plugins/AssetsPlugin.js +62 -80
  157. package/dist/lib/output/plugins/IconsPlugin.d.ts +3 -2
  158. package/dist/lib/output/plugins/IconsPlugin.js +28 -84
  159. package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +9 -2
  160. package/dist/lib/output/plugins/JavascriptIndexPlugin.js +90 -96
  161. package/dist/lib/output/plugins/NavigationPlugin.d.ts +3 -2
  162. package/dist/lib/output/plugins/NavigationPlugin.js +22 -102
  163. package/dist/lib/output/plugins/SitemapPlugin.d.ts +3 -2
  164. package/dist/lib/output/plugins/SitemapPlugin.js +60 -120
  165. package/dist/lib/output/plugins/index.d.ts +6 -6
  166. package/dist/lib/output/plugins/index.js +6 -15
  167. package/dist/lib/output/renderer.d.ts +14 -13
  168. package/dist/lib/output/renderer.js +129 -185
  169. package/dist/lib/output/theme.d.ts +9 -5
  170. package/dist/lib/output/theme.js +14 -62
  171. package/dist/lib/output/themes/MarkedPlugin.d.ts +8 -9
  172. package/dist/lib/output/themes/MarkedPlugin.js +152 -117
  173. package/dist/lib/output/themes/default/DefaultTheme.d.ts +17 -29
  174. package/dist/lib/output/themes/default/DefaultTheme.js +334 -310
  175. package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +63 -48
  176. package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +119 -95
  177. package/dist/lib/output/themes/default/Slugger.d.ts +13 -0
  178. package/dist/lib/output/themes/default/Slugger.js +46 -0
  179. package/dist/lib/output/themes/default/layouts/default.d.ts +5 -5
  180. package/dist/lib/output/themes/default/layouts/default.js +47 -36
  181. package/dist/lib/output/themes/default/partials/anchor-icon.d.ts +2 -2
  182. package/dist/lib/output/themes/default/partials/anchor-icon.js +4 -7
  183. package/dist/lib/output/themes/default/partials/breadcrumb.d.ts +3 -3
  184. package/dist/lib/output/themes/default/partials/breadcrumb.js +4 -8
  185. package/dist/lib/output/themes/default/partials/comment.d.ts +6 -4
  186. package/dist/lib/output/themes/default/partials/comment.js +52 -29
  187. package/dist/lib/output/themes/default/partials/footer.d.ts +2 -2
  188. package/dist/lib/output/themes/default/partials/footer.js +11 -14
  189. package/dist/lib/output/themes/default/partials/header.d.ts +4 -4
  190. package/dist/lib/output/themes/default/partials/header.js +9 -13
  191. package/dist/lib/output/themes/default/partials/hierarchy.d.ts +3 -3
  192. package/dist/lib/output/themes/default/partials/hierarchy.js +9 -12
  193. package/dist/lib/output/themes/default/partials/icon.d.ts +4 -4
  194. package/dist/lib/output/themes/default/partials/icon.js +78 -73
  195. package/dist/lib/output/themes/default/partials/index.d.ts +3 -3
  196. package/dist/lib/output/themes/default/partials/index.js +19 -22
  197. package/dist/lib/output/themes/default/partials/member.d.ts +3 -3
  198. package/dist/lib/output/themes/default/partials/member.declaration.d.ts +3 -3
  199. package/dist/lib/output/themes/default/partials/member.declaration.js +18 -61
  200. package/dist/lib/output/themes/default/partials/member.getterSetter.d.ts +3 -3
  201. package/dist/lib/output/themes/default/partials/member.getterSetter.js +10 -26
  202. package/dist/lib/output/themes/default/partials/member.js +19 -24
  203. package/dist/lib/output/themes/default/partials/member.signature.body.d.ts +3 -3
  204. package/dist/lib/output/themes/default/partials/member.signature.body.js +17 -21
  205. package/dist/lib/output/themes/default/partials/member.signature.title.d.ts +4 -7
  206. package/dist/lib/output/themes/default/partials/member.signature.title.js +8 -35
  207. package/dist/lib/output/themes/default/partials/member.signatures.d.ts +3 -3
  208. package/dist/lib/output/themes/default/partials/member.signatures.js +9 -13
  209. package/dist/lib/output/themes/default/partials/member.sources.d.ts +3 -3
  210. package/dist/lib/output/themes/default/partials/member.sources.js +13 -17
  211. package/dist/lib/output/themes/default/partials/members.d.ts +3 -3
  212. package/dist/lib/output/themes/default/partials/members.js +10 -42
  213. package/dist/lib/output/themes/default/partials/moduleReflection.d.ts +5 -0
  214. package/dist/lib/output/themes/default/partials/moduleReflection.js +62 -0
  215. package/dist/lib/output/themes/default/partials/navigation.d.ts +4 -4
  216. package/dist/lib/output/themes/default/partials/navigation.js +51 -62
  217. package/dist/lib/output/themes/default/partials/reflectionPreview.d.ts +3 -3
  218. package/dist/lib/output/themes/default/partials/reflectionPreview.js +12 -15
  219. package/dist/lib/output/themes/default/partials/toolbar.d.ts +4 -4
  220. package/dist/lib/output/themes/default/partials/toolbar.js +16 -20
  221. package/dist/lib/output/themes/default/partials/type.d.ts +4 -6
  222. package/dist/lib/output/themes/default/partials/type.js +8 -388
  223. package/dist/lib/output/themes/default/partials/typeAndParent.d.ts +3 -3
  224. package/dist/lib/output/themes/default/partials/typeAndParent.js +11 -15
  225. package/dist/lib/output/themes/default/partials/typeDetails.d.ts +8 -0
  226. package/dist/lib/output/themes/default/partials/typeDetails.js +221 -0
  227. package/dist/lib/output/themes/default/partials/typeParameters.d.ts +3 -3
  228. package/dist/lib/output/themes/default/partials/typeParameters.js +14 -17
  229. package/dist/lib/output/themes/default/templates/document.d.ts +4 -4
  230. package/dist/lib/output/themes/default/templates/document.js +3 -7
  231. package/dist/lib/output/themes/default/templates/hierarchy.d.ts +4 -4
  232. package/dist/lib/output/themes/default/templates/hierarchy.js +10 -13
  233. package/dist/lib/output/themes/default/templates/index.d.ts +4 -4
  234. package/dist/lib/output/themes/default/templates/index.js +3 -7
  235. package/dist/lib/output/themes/default/templates/reflection.d.ts +4 -4
  236. package/dist/lib/output/themes/default/templates/reflection.js +31 -34
  237. package/dist/lib/output/themes/lib.d.ts +17 -3
  238. package/dist/lib/output/themes/lib.js +110 -49
  239. package/dist/lib/serialization/components.d.ts +2 -5
  240. package/dist/lib/serialization/components.js +1 -2
  241. package/dist/lib/serialization/deserializer.d.ts +21 -7
  242. package/dist/lib/serialization/deserializer.js +138 -123
  243. package/dist/lib/serialization/events.d.ts +2 -2
  244. package/dist/lib/serialization/events.js +6 -5
  245. package/dist/lib/serialization/index.d.ts +5 -5
  246. package/dist/lib/serialization/index.js +4 -33
  247. package/dist/lib/serialization/schema.d.ts +8 -2
  248. package/dist/lib/serialization/schema.js +2 -2
  249. package/dist/lib/serialization/serializer.d.ts +11 -5
  250. package/dist/lib/serialization/serializer.js +32 -25
  251. package/dist/lib/utils/array.d.ts +3 -0
  252. package/dist/lib/utils/array.js +26 -27
  253. package/dist/lib/utils/component.d.ts +2 -44
  254. package/dist/lib/utils/component.js +10 -102
  255. package/dist/lib/utils/entry-point.d.ts +3 -4
  256. package/dist/lib/utils/entry-point.js +114 -85
  257. package/dist/lib/utils/enum.js +6 -14
  258. package/dist/lib/utils/events.js +6 -12
  259. package/dist/lib/utils/fs.js +50 -91
  260. package/dist/lib/utils/general.d.ts +2 -1
  261. package/dist/lib/utils/general.js +50 -40
  262. package/dist/lib/utils/highlighter.js +30 -57
  263. package/dist/lib/utils/hooks.js +7 -13
  264. package/dist/lib/utils/html-entities.d.ts +8926 -0
  265. package/dist/lib/utils/html-entities.js +2329 -0
  266. package/dist/lib/utils/html.d.ts +8 -0
  267. package/dist/lib/utils/html.js +81 -34
  268. package/dist/lib/utils/index.d.ts +22 -22
  269. package/dist/lib/utils/index.js +20 -91
  270. package/dist/lib/utils/jsx.d.ts +12 -5
  271. package/dist/lib/utils/jsx.elements.js +1 -4
  272. package/dist/lib/utils/jsx.js +53 -20
  273. package/dist/lib/utils/loggers.d.ts +3 -3
  274. package/dist/lib/utils/loggers.js +36 -46
  275. package/dist/lib/utils/map.js +6 -13
  276. package/dist/lib/utils/minimalSourceFile.js +5 -7
  277. package/dist/lib/utils/options/declaration.d.ts +33 -7
  278. package/dist/lib/utils/options/declaration.js +20 -22
  279. package/dist/lib/utils/options/defaults.d.ts +3 -2
  280. package/dist/lib/utils/options/defaults.js +18 -38
  281. package/dist/lib/utils/options/help.d.ts +2 -2
  282. package/dist/lib/utils/options/help.js +7 -10
  283. package/dist/lib/utils/options/index.d.ts +6 -6
  284. package/dist/lib/utils/options/index.js +4 -18
  285. package/dist/lib/utils/options/options.d.ts +8 -5
  286. package/dist/lib/utils/options/options.js +47 -71
  287. package/dist/lib/utils/options/readers/arguments.d.ts +2 -2
  288. package/dist/lib/utils/options/readers/arguments.js +15 -17
  289. package/dist/lib/utils/options/readers/index.d.ts +4 -4
  290. package/dist/lib/utils/options/readers/index.js +4 -11
  291. package/dist/lib/utils/options/readers/package-json.d.ts +3 -3
  292. package/dist/lib/utils/options/readers/package-json.js +15 -21
  293. package/dist/lib/utils/options/readers/tsconfig.d.ts +2 -2
  294. package/dist/lib/utils/options/readers/tsconfig.js +54 -63
  295. package/dist/lib/utils/options/readers/typedoc.d.ts +3 -3
  296. package/dist/lib/utils/options/readers/typedoc.js +44 -76
  297. package/dist/lib/utils/options/sources/index.d.ts +1 -1
  298. package/dist/lib/utils/options/sources/index.js +1 -5
  299. package/dist/lib/utils/options/sources/typedoc.d.ts +1 -1
  300. package/dist/lib/utils/options/sources/typedoc.js +220 -196
  301. package/dist/lib/utils/options/tsdoc-defaults.d.ts +3 -3
  302. package/dist/lib/utils/options/tsdoc-defaults.js +16 -12
  303. package/dist/lib/utils/package-manifest.d.ts +1 -1
  304. package/dist/lib/utils/package-manifest.js +15 -19
  305. package/dist/lib/utils/paths.js +9 -15
  306. package/dist/lib/utils/perf.js +6 -11
  307. package/dist/lib/utils/plugins.d.ts +1 -1
  308. package/dist/lib/utils/plugins.js +7 -10
  309. package/dist/lib/utils/reflections.d.ts +1 -1
  310. package/dist/lib/utils/reflections.js +9 -12
  311. package/dist/lib/utils/set.js +2 -6
  312. package/dist/lib/utils/sort.d.ts +3 -3
  313. package/dist/lib/utils/sort.js +20 -24
  314. package/dist/lib/utils/tsconfig.d.ts +1 -1
  315. package/dist/lib/utils/tsconfig.js +13 -21
  316. package/dist/lib/utils/tsutils.d.ts +1 -1
  317. package/dist/lib/utils/tsutils.js +3 -30
  318. package/dist/lib/utils/validation.js +6 -12
  319. package/dist/lib/validation/documentation.d.ts +2 -2
  320. package/dist/lib/validation/documentation.js +26 -29
  321. package/dist/lib/validation/exports.d.ts +2 -2
  322. package/dist/lib/validation/exports.js +9 -11
  323. package/dist/lib/validation/links.d.ts +2 -2
  324. package/dist/lib/validation/links.js +4 -7
  325. package/dist/lib/validation/unusedMergeModuleWith.d.ts +3 -0
  326. package/dist/lib/validation/unusedMergeModuleWith.js +11 -0
  327. package/package.json +14 -11
  328. package/static/main.js +4 -4
  329. package/static/style.css +91 -2
  330. package/tsdoc.json +30 -0
  331. package/dist/lib/output/themes/default/partials/member.reference.d.ts +0 -4
  332. package/dist/lib/output/themes/default/partials/member.reference.js +0 -30
  333. package/dist/lib/output/themes/default/partials/parameter.d.ts +0 -4
  334. package/dist/lib/output/themes/default/partials/parameter.js +0 -79
  335. package/dist/lib/utils/html-entities.json +0 -2326
@@ -1,38 +1,32 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.convertSymbol = convertSymbol;
7
- const assert_1 = __importDefault(require("assert"));
8
- const typescript_1 = __importDefault(require("typescript"));
9
- const models_1 = require("../models");
10
- const enum_1 = require("../utils/enum");
11
- const convert_expression_1 = require("./convert-expression");
12
- const index_signature_1 = require("./factories/index-signature");
13
- const signature_1 = require("./factories/signature");
14
- const jsdoc_1 = require("./jsdoc");
15
- const nodes_1 = require("./utils/nodes");
16
- const reflections_1 = require("./utils/reflections");
1
+ import assert from "assert";
2
+ import ts from "typescript";
3
+ import { DeclarationReflection, IntrinsicType, LiteralType, ReferenceReflection, ReflectionFlag, ReflectionKind, } from "../models/index.js";
4
+ import { getEnumFlags, hasAllFlags, hasAnyFlag, removeFlag, } from "../utils/enum.js";
5
+ import { convertDefaultValue } from "./convert-expression.js";
6
+ import { convertIndexSignatures } from "./factories/index-signature.js";
7
+ import { createConstructSignatureWithType, createSignature, createTypeParamReflection, } from "./factories/signature.js";
8
+ import { convertJsDocAlias, convertJsDocCallback } from "./jsdoc.js";
9
+ import { getHeritageTypes } from "./utils/nodes.js";
10
+ import { removeUndefined } from "./utils/reflections.js";
17
11
  const symbolConverters = {
18
- [typescript_1.default.SymbolFlags.RegularEnum]: convertEnum,
19
- [typescript_1.default.SymbolFlags.ConstEnum]: convertEnum,
20
- [typescript_1.default.SymbolFlags.EnumMember]: convertEnumMember,
21
- [typescript_1.default.SymbolFlags.ValueModule]: convertNamespace,
22
- [typescript_1.default.SymbolFlags.NamespaceModule]: convertNamespace,
23
- [typescript_1.default.SymbolFlags.TypeAlias]: convertTypeAlias,
24
- [typescript_1.default.SymbolFlags.Function]: convertFunctionOrMethod,
25
- [typescript_1.default.SymbolFlags.Method]: convertFunctionOrMethod,
26
- [typescript_1.default.SymbolFlags.Interface]: convertClassOrInterface,
27
- [typescript_1.default.SymbolFlags.Property]: convertProperty,
28
- [typescript_1.default.SymbolFlags.Class]: convertClassOrInterface,
29
- [typescript_1.default.SymbolFlags.Constructor]: convertConstructor,
30
- [typescript_1.default.SymbolFlags.Alias]: convertAlias,
31
- [typescript_1.default.SymbolFlags.BlockScopedVariable]: convertVariable,
32
- [typescript_1.default.SymbolFlags.FunctionScopedVariable]: convertVariable,
33
- [typescript_1.default.SymbolFlags.ExportValue]: convertVariable,
34
- [typescript_1.default.SymbolFlags.GetAccessor]: convertAccessor,
35
- [typescript_1.default.SymbolFlags.SetAccessor]: convertAccessor,
12
+ [ts.SymbolFlags.RegularEnum]: convertEnum,
13
+ [ts.SymbolFlags.ConstEnum]: convertEnum,
14
+ [ts.SymbolFlags.EnumMember]: convertEnumMember,
15
+ [ts.SymbolFlags.ValueModule]: convertNamespace,
16
+ [ts.SymbolFlags.NamespaceModule]: convertNamespace,
17
+ [ts.SymbolFlags.TypeAlias]: convertTypeAlias,
18
+ [ts.SymbolFlags.Function]: convertFunctionOrMethod,
19
+ [ts.SymbolFlags.Method]: convertFunctionOrMethod,
20
+ [ts.SymbolFlags.Interface]: convertClassOrInterface,
21
+ [ts.SymbolFlags.Property]: convertProperty,
22
+ [ts.SymbolFlags.Class]: convertClassOrInterface,
23
+ [ts.SymbolFlags.Constructor]: convertConstructor,
24
+ [ts.SymbolFlags.Alias]: convertAlias,
25
+ [ts.SymbolFlags.BlockScopedVariable]: convertVariable,
26
+ [ts.SymbolFlags.FunctionScopedVariable]: convertVariable,
27
+ [ts.SymbolFlags.ExportValue]: convertVariable,
28
+ [ts.SymbolFlags.GetAccessor]: convertAccessor,
29
+ [ts.SymbolFlags.SetAccessor]: convertAccessor,
36
30
  };
37
31
  const allConverterFlags = Object.keys(symbolConverters).reduce((v, k) => v | +k, 0);
38
32
  // This is kind of a hack, born of resolving references by symbols instead
@@ -40,39 +34,39 @@ const allConverterFlags = Object.keys(symbolConverters).reduce((v, k) => v | +k,
40
34
  const conversionOrder = [
41
35
  // Do enums before namespaces so that @hidden on a namespace
42
36
  // merged with an enum works properly.
43
- typescript_1.default.SymbolFlags.RegularEnum,
44
- typescript_1.default.SymbolFlags.ConstEnum,
45
- typescript_1.default.SymbolFlags.EnumMember,
37
+ ts.SymbolFlags.RegularEnum,
38
+ ts.SymbolFlags.ConstEnum,
39
+ ts.SymbolFlags.EnumMember,
46
40
  // Before type alias
47
- typescript_1.default.SymbolFlags.BlockScopedVariable,
48
- typescript_1.default.SymbolFlags.FunctionScopedVariable,
49
- typescript_1.default.SymbolFlags.ExportValue,
50
- typescript_1.default.SymbolFlags.Function, // Before NamespaceModule
51
- typescript_1.default.SymbolFlags.TypeAlias,
52
- typescript_1.default.SymbolFlags.Method,
53
- typescript_1.default.SymbolFlags.Interface,
54
- typescript_1.default.SymbolFlags.Property,
55
- typescript_1.default.SymbolFlags.Class,
56
- typescript_1.default.SymbolFlags.Constructor,
57
- typescript_1.default.SymbolFlags.Alias,
58
- typescript_1.default.SymbolFlags.GetAccessor,
59
- typescript_1.default.SymbolFlags.SetAccessor,
60
- typescript_1.default.SymbolFlags.ValueModule,
61
- typescript_1.default.SymbolFlags.NamespaceModule,
41
+ ts.SymbolFlags.BlockScopedVariable,
42
+ ts.SymbolFlags.FunctionScopedVariable,
43
+ ts.SymbolFlags.ExportValue,
44
+ ts.SymbolFlags.Function, // Before NamespaceModule
45
+ ts.SymbolFlags.TypeAlias,
46
+ ts.SymbolFlags.Method,
47
+ ts.SymbolFlags.Interface,
48
+ ts.SymbolFlags.Property,
49
+ ts.SymbolFlags.Class,
50
+ ts.SymbolFlags.Constructor,
51
+ ts.SymbolFlags.Alias,
52
+ ts.SymbolFlags.GetAccessor,
53
+ ts.SymbolFlags.SetAccessor,
54
+ ts.SymbolFlags.ValueModule,
55
+ ts.SymbolFlags.NamespaceModule,
62
56
  ];
63
57
  // Sanity check, if this fails a dev messed up.
64
58
  for (const key of Object.keys(symbolConverters)) {
65
59
  if (!Number.isInteger(Math.log2(+key))) {
66
- throw new Error(`Symbol converter for key ${typescript_1.default.SymbolFlags[+key]} does not specify a valid flag value.`);
60
+ throw new Error(`Symbol converter for key ${ts.SymbolFlags[+key]} does not specify a valid flag value.`);
67
61
  }
68
62
  if (!conversionOrder.includes(+key)) {
69
- throw new Error(`Symbol converter for key ${typescript_1.default.SymbolFlags[+key]} is not specified in conversionOrder`);
63
+ throw new Error(`Symbol converter for key ${ts.SymbolFlags[+key]} is not specified in conversionOrder`);
70
64
  }
71
65
  }
72
66
  if (conversionOrder.reduce((a, b) => a | b, 0) !== allConverterFlags) {
73
67
  throw new Error("conversionOrder contains a symbol flag that converters do not.");
74
68
  }
75
- function convertSymbol(context, symbol, exportSymbol) {
69
+ export function convertSymbol(context, symbol, exportSymbol) {
76
70
  if (context.shouldIgnore(symbol)) {
77
71
  return;
78
72
  }
@@ -80,42 +74,42 @@ function convertSymbol(context, symbol, exportSymbol) {
80
74
  // but aren't aliased symbols because `export *` was used.
81
75
  const previous = context.project.getReflectionFromSymbol(symbol);
82
76
  if (previous &&
83
- previous.parent?.kindOf(models_1.ReflectionKind.SomeModule | models_1.ReflectionKind.Project)) {
77
+ previous.parent?.kindOf(ReflectionKind.SomeModule | ReflectionKind.Project)) {
84
78
  createAlias(previous, context, symbol, exportSymbol);
85
79
  return;
86
80
  }
87
- let flags = (0, enum_1.removeFlag)(symbol.flags, typescript_1.default.SymbolFlags.Transient |
88
- typescript_1.default.SymbolFlags.Assignment |
89
- typescript_1.default.SymbolFlags.Optional |
90
- typescript_1.default.SymbolFlags.Prototype);
81
+ let flags = removeFlag(symbol.flags, ts.SymbolFlags.Transient |
82
+ ts.SymbolFlags.Assignment |
83
+ ts.SymbolFlags.Optional |
84
+ ts.SymbolFlags.Prototype);
91
85
  // Declaration merging - the only type (excluding enum/enum, ns/ns, etc)
92
86
  // that TD supports is merging a class and interface. All others are
93
87
  // represented as multiple reflections
94
- if ((0, enum_1.hasAllFlags)(symbol.flags, typescript_1.default.SymbolFlags.Class)) {
95
- flags = (0, enum_1.removeFlag)(flags, typescript_1.default.SymbolFlags.Interface | typescript_1.default.SymbolFlags.Function);
88
+ if (hasAllFlags(symbol.flags, ts.SymbolFlags.Class)) {
89
+ flags = removeFlag(flags, ts.SymbolFlags.Interface | ts.SymbolFlags.Function);
96
90
  }
97
91
  // Kind of declaration merging... we treat this as a property with get/set signatures.
98
- if ((0, enum_1.hasAllFlags)(symbol.flags, typescript_1.default.SymbolFlags.GetAccessor)) {
99
- flags = (0, enum_1.removeFlag)(flags, typescript_1.default.SymbolFlags.SetAccessor);
92
+ if (hasAllFlags(symbol.flags, ts.SymbolFlags.GetAccessor)) {
93
+ flags = removeFlag(flags, ts.SymbolFlags.SetAccessor);
100
94
  }
101
- if ((0, enum_1.hasAllFlags)(symbol.flags, typescript_1.default.SymbolFlags.NamespaceModule)) {
95
+ if (hasAllFlags(symbol.flags, ts.SymbolFlags.NamespaceModule)) {
102
96
  // This might be here if a namespace is declared several times.
103
97
  // Or if it's a namespace-like thing defined on a function
104
98
  // In the function case, it's important to remove ValueModule so that
105
99
  // if we convert the children as properties of the function rather than as
106
100
  // a separate namespace, we skip creating the namespace.
107
- flags = (0, enum_1.removeFlag)(flags, typescript_1.default.SymbolFlags.ValueModule);
101
+ flags = removeFlag(flags, ts.SymbolFlags.ValueModule);
108
102
  }
109
- if ((0, enum_1.hasAnyFlag)(symbol.flags, typescript_1.default.SymbolFlags.Method |
110
- typescript_1.default.SymbolFlags.Interface |
111
- typescript_1.default.SymbolFlags.Class |
112
- typescript_1.default.SymbolFlags.Variable)) {
103
+ if (hasAnyFlag(symbol.flags, ts.SymbolFlags.Method |
104
+ ts.SymbolFlags.Interface |
105
+ ts.SymbolFlags.Class |
106
+ ts.SymbolFlags.Variable)) {
113
107
  // This happens when someone declares an object with methods:
114
108
  // { methodProperty() {} }
115
- flags = (0, enum_1.removeFlag)(flags, typescript_1.default.SymbolFlags.Property);
109
+ flags = removeFlag(flags, ts.SymbolFlags.Property);
116
110
  }
117
- for (const flag of (0, enum_1.getEnumFlags)(flags & ~allConverterFlags)) {
118
- context.logger.verbose(`Missing converter for symbol: ${symbol.name} with flag ${typescript_1.default.SymbolFlags[flag]}`);
111
+ for (const flag of getEnumFlags(flags & ~allConverterFlags)) {
112
+ context.logger.verbose(`Missing converter for symbol: ${symbol.name} with flag ${ts.SymbolFlags[flag]}`);
119
113
  }
120
114
  // Note: This method does not allow skipping earlier converters.
121
115
  // For now, this is fine... might not be flexible enough in the future.
@@ -134,48 +128,48 @@ function convertSymbols(context, symbols) {
134
128
  }
135
129
  }
136
130
  function convertEnum(context, symbol, exportSymbol) {
137
- const reflection = context.createDeclarationReflection(models_1.ReflectionKind.Enum, symbol, exportSymbol);
138
- if (symbol.flags & typescript_1.default.SymbolFlags.ConstEnum) {
139
- reflection.setFlag(models_1.ReflectionFlag.Const);
131
+ const reflection = context.createDeclarationReflection(ReflectionKind.Enum, symbol, exportSymbol);
132
+ if (symbol.flags & ts.SymbolFlags.ConstEnum) {
133
+ reflection.setFlag(ReflectionFlag.Const);
140
134
  }
141
135
  context.finalizeDeclarationReflection(reflection);
142
136
  convertSymbols(context.withScope(reflection), context.checker
143
137
  .getExportsOfModule(symbol)
144
- .filter((s) => s.flags & typescript_1.default.SymbolFlags.EnumMember));
138
+ .filter((s) => s.flags & ts.SymbolFlags.EnumMember));
145
139
  }
146
140
  function convertEnumMember(context, symbol, exportSymbol) {
147
- const reflection = context.createDeclarationReflection(models_1.ReflectionKind.EnumMember, symbol, exportSymbol);
141
+ const reflection = context.createDeclarationReflection(ReflectionKind.EnumMember, symbol, exportSymbol);
148
142
  const defaultValue = context.checker.getConstantValue(symbol.getDeclarations()[0]);
149
143
  if (defaultValue !== undefined) {
150
- reflection.type = new models_1.LiteralType(defaultValue);
144
+ reflection.type = new LiteralType(defaultValue);
151
145
  }
152
146
  else {
153
147
  // We know this has to be a number, because computed values aren't allowed
154
148
  // in string enums, so otherwise we would have to have the constant value
155
- reflection.type = new models_1.IntrinsicType("number");
149
+ reflection.type = new IntrinsicType("number");
156
150
  }
157
151
  context.finalizeDeclarationReflection(reflection);
158
152
  }
159
153
  function convertNamespace(context, symbol, exportSymbol) {
160
- let exportFlags = typescript_1.default.SymbolFlags.ModuleMember;
154
+ let exportFlags = ts.SymbolFlags.ModuleMember;
161
155
  // This can happen in JS land where "class" functions get tagged as a namespace too
162
156
  if (symbol
163
157
  .getDeclarations()
164
- ?.some((d) => typescript_1.default.isModuleDeclaration(d) || typescript_1.default.isSourceFile(d)) !==
158
+ ?.some((d) => ts.isModuleDeclaration(d) || ts.isSourceFile(d)) !==
165
159
  true) {
166
- exportFlags = typescript_1.default.SymbolFlags.ClassMember;
167
- if ((0, enum_1.hasAnyFlag)(symbol.flags, typescript_1.default.SymbolFlags.Class)) {
160
+ exportFlags = ts.SymbolFlags.ClassMember;
161
+ if (hasAnyFlag(symbol.flags, ts.SymbolFlags.Class)) {
168
162
  return;
169
163
  }
170
164
  }
171
165
  // #2364, @namespace on a variable might be merged with a namespace containing types.
172
166
  const existingReflection = context.project.getReflectionFromSymbol(exportSymbol || symbol);
173
167
  let reflection;
174
- if (existingReflection?.kind === models_1.ReflectionKind.Namespace) {
168
+ if (existingReflection?.kind === ReflectionKind.Namespace) {
175
169
  reflection = existingReflection;
176
170
  }
177
171
  else {
178
- reflection = context.createDeclarationReflection(models_1.ReflectionKind.Namespace, symbol, exportSymbol);
172
+ reflection = context.createDeclarationReflection(ReflectionKind.Namespace, symbol, exportSymbol);
179
173
  context.finalizeDeclarationReflection(reflection);
180
174
  }
181
175
  convertSymbols(context.withScope(reflection), context.checker
@@ -185,38 +179,44 @@ function convertNamespace(context, symbol, exportSymbol) {
185
179
  function convertTypeAlias(context, symbol, exportSymbol) {
186
180
  const declaration = symbol
187
181
  .getDeclarations()
188
- ?.find((d) => typescript_1.default.isTypeAliasDeclaration(d) ||
189
- typescript_1.default.isJSDocTypedefTag(d) ||
190
- typescript_1.default.isJSDocCallbackTag(d) ||
191
- typescript_1.default.isJSDocEnumTag(d));
192
- (0, assert_1.default)(declaration);
193
- if (typescript_1.default.isTypeAliasDeclaration(declaration)) {
182
+ ?.find((d) => ts.isTypeAliasDeclaration(d) ||
183
+ ts.isJSDocTypedefTag(d) ||
184
+ ts.isJSDocCallbackTag(d) ||
185
+ ts.isJSDocEnumTag(d));
186
+ assert(declaration);
187
+ if (ts.isTypeAliasDeclaration(declaration)) {
194
188
  if (context
195
- .getComment(symbol, models_1.ReflectionKind.TypeAlias)
189
+ .getComment(symbol, ReflectionKind.TypeAlias)
196
190
  ?.hasModifier("@interface")) {
197
191
  return convertTypeAliasAsInterface(context, symbol, exportSymbol, declaration);
198
192
  }
199
- const reflection = context.createDeclarationReflection(models_1.ReflectionKind.TypeAlias, symbol, exportSymbol);
200
- reflection.type = context.converter.convertType(context.withScope(reflection), declaration.type);
193
+ const reflection = context.createDeclarationReflection(ReflectionKind.TypeAlias, symbol, exportSymbol);
194
+ if (reflection.comment?.hasModifier("@useDeclaredType")) {
195
+ reflection.comment.removeModifier("@useDeclaredType");
196
+ reflection.type = context.converter.convertType(context.withScope(reflection), context.checker.getDeclaredTypeOfSymbol(symbol));
197
+ }
198
+ else {
199
+ reflection.type = context.converter.convertType(context.withScope(reflection), declaration.type);
200
+ }
201
201
  if (reflection.type.type === "union") {
202
202
  attachUnionComments(context, declaration, reflection.type);
203
203
  }
204
204
  context.finalizeDeclarationReflection(reflection);
205
205
  // Do this after finalization so that the CommentPlugin can get @typeParam tags
206
206
  // from the parent comment. Ugly, but works for now. Should be cleaned up eventually.
207
- reflection.typeParameters = declaration.typeParameters?.map((param) => (0, signature_1.createTypeParamReflection)(param, context.withScope(reflection)));
207
+ reflection.typeParameters = declaration.typeParameters?.map((param) => createTypeParamReflection(param, context.withScope(reflection)));
208
208
  }
209
- else if (typescript_1.default.isJSDocTypedefTag(declaration) ||
210
- typescript_1.default.isJSDocEnumTag(declaration)) {
211
- (0, jsdoc_1.convertJsDocAlias)(context, symbol, declaration, exportSymbol);
209
+ else if (ts.isJSDocTypedefTag(declaration) ||
210
+ ts.isJSDocEnumTag(declaration)) {
211
+ convertJsDocAlias(context, symbol, declaration, exportSymbol);
212
212
  }
213
213
  else {
214
- (0, jsdoc_1.convertJsDocCallback)(context, symbol, declaration, exportSymbol);
214
+ convertJsDocCallback(context, symbol, declaration, exportSymbol);
215
215
  }
216
216
  }
217
217
  function attachUnionComments(context, declaration, union) {
218
218
  const list = declaration.type.getChildAt(0);
219
- if (list.kind !== typescript_1.default.SyntaxKind.SyntaxList)
219
+ if (list.kind !== ts.SyntaxKind.SyntaxList)
220
220
  return;
221
221
  let unionIndex = 0;
222
222
  for (const child of list.getChildren()) {
@@ -228,17 +228,17 @@ function attachUnionComments(context, declaration, union) {
228
228
  union.elementSummaries ||= Array.from({ length: union.types.length }, () => []);
229
229
  union.elementSummaries[unionIndex] = comment.summary;
230
230
  }
231
- if (child.kind !== typescript_1.default.SyntaxKind.BarToken) {
231
+ if (child.kind !== ts.SyntaxKind.BarToken) {
232
232
  ++unionIndex;
233
233
  }
234
234
  }
235
235
  }
236
236
  function convertTypeAliasAsInterface(context, symbol, exportSymbol, declaration) {
237
- const reflection = context.createDeclarationReflection(models_1.ReflectionKind.Interface, symbol, exportSymbol);
237
+ const reflection = context.createDeclarationReflection(ReflectionKind.Interface, symbol, exportSymbol);
238
238
  context.finalizeDeclarationReflection(reflection);
239
239
  const rc = context.withScope(reflection);
240
240
  const type = context.checker.getTypeAtLocation(declaration);
241
- if (type.getFlags() & typescript_1.default.TypeFlags.Union) {
241
+ if (type.getFlags() & ts.TypeFlags.Union) {
242
242
  context.logger.warn(context.i18n.converting_union_as_interface(), declaration);
243
243
  }
244
244
  // Interfaces have properties
@@ -247,51 +247,51 @@ function convertTypeAliasAsInterface(context, symbol, exportSymbol, declaration)
247
247
  if (declaration.typeParameters) {
248
248
  reflection.typeParameters = declaration.typeParameters.map((param) => {
249
249
  const declaration = param.symbol?.declarations?.[0];
250
- (0, assert_1.default)(declaration && typescript_1.default.isTypeParameterDeclaration(declaration));
251
- return (0, signature_1.createTypeParamReflection)(declaration, rc);
250
+ assert(declaration && ts.isTypeParameterDeclaration(declaration));
251
+ return createTypeParamReflection(declaration, rc);
252
252
  });
253
253
  }
254
254
  // And maybe call signatures
255
255
  context.checker
256
- .getSignaturesOfType(type, typescript_1.default.SignatureKind.Call)
257
- .forEach((sig) => (0, signature_1.createSignature)(rc, models_1.ReflectionKind.CallSignature, sig, symbol));
256
+ .getSignaturesOfType(type, ts.SignatureKind.Call)
257
+ .forEach((sig) => createSignature(rc, ReflectionKind.CallSignature, sig, symbol));
258
258
  // And maybe constructor signatures
259
259
  convertConstructSignatures(rc, symbol);
260
260
  // And finally, index signatures
261
- (0, index_signature_1.convertIndexSignatures)(rc, symbol);
261
+ convertIndexSignatures(rc, symbol);
262
262
  }
263
263
  function convertFunctionOrMethod(context, symbol, exportSymbol) {
264
264
  // Can't just check method flag because this might be called for properties as well
265
265
  // This will *NOT* be called for variables that look like functions, they need a special case.
266
266
  const isMethod = !!(symbol.flags &
267
- (typescript_1.default.SymbolFlags.Property | typescript_1.default.SymbolFlags.Method));
267
+ (ts.SymbolFlags.Property | ts.SymbolFlags.Method));
268
268
  if (!isMethod) {
269
- const comment = context.getComment(symbol, models_1.ReflectionKind.Function);
269
+ const comment = context.getComment(symbol, ReflectionKind.Function);
270
270
  if (comment?.hasModifier("@class")) {
271
271
  return convertSymbolAsClass(context, symbol, exportSymbol);
272
272
  }
273
273
  }
274
- const declarations = symbol.getDeclarations()?.filter(typescript_1.default.isFunctionLike) ?? [];
274
+ const declarations = symbol.getDeclarations()?.filter(ts.isFunctionLike) ?? [];
275
275
  // Don't do anything if we inherited this method and it is private.
276
276
  if (isMethod &&
277
277
  isInherited(context, symbol) &&
278
278
  declarations.length > 0 &&
279
- (0, enum_1.hasAllFlags)(typescript_1.default.getCombinedModifierFlags(declarations[0]), typescript_1.default.ModifierFlags.Private)) {
279
+ hasAllFlags(ts.getCombinedModifierFlags(declarations[0]), ts.ModifierFlags.Private)) {
280
280
  return;
281
281
  }
282
282
  const locationDeclaration = symbol.parent
283
283
  ?.getDeclarations()
284
- ?.find((d) => typescript_1.default.isClassDeclaration(d) || typescript_1.default.isInterfaceDeclaration(d)) ??
284
+ ?.find((d) => ts.isClassDeclaration(d) || ts.isInterfaceDeclaration(d)) ??
285
285
  symbol.parent?.getDeclarations()?.[0]?.getSourceFile() ??
286
286
  symbol.getDeclarations()?.[0]?.getSourceFile();
287
- (0, assert_1.default)(locationDeclaration, "Missing declaration context");
287
+ assert(locationDeclaration, "Missing declaration context");
288
288
  const type = context.checker.getTypeOfSymbolAtLocation(symbol, locationDeclaration);
289
289
  // Need to get the non nullable type because interface methods might be declared
290
290
  // with a question token. See GH1490.
291
291
  const signatures = type.getNonNullableType().getCallSignatures();
292
- const reflection = context.createDeclarationReflection(context.scope.kindOf(models_1.ReflectionKind.MethodContainer)
293
- ? models_1.ReflectionKind.Method
294
- : models_1.ReflectionKind.Function, symbol, exportSymbol, void 0);
292
+ const reflection = context.createDeclarationReflection(context.scope.kindOf(ReflectionKind.MethodContainer)
293
+ ? ReflectionKind.Method
294
+ : ReflectionKind.Function, symbol, exportSymbol, void 0);
295
295
  if (symbol.declarations?.length && isMethod) {
296
296
  // All method signatures must have the same modifier flags.
297
297
  setModifiers(symbol, symbol.declarations[0], reflection);
@@ -299,34 +299,34 @@ function convertFunctionOrMethod(context, symbol, exportSymbol) {
299
299
  context.finalizeDeclarationReflection(reflection);
300
300
  const scope = context.withScope(reflection);
301
301
  for (const sig of signatures) {
302
- (0, signature_1.createSignature)(scope, models_1.ReflectionKind.CallSignature, sig, symbol);
302
+ createSignature(scope, ReflectionKind.CallSignature, sig, symbol);
303
303
  }
304
304
  return convertFunctionProperties(scope, symbol, type);
305
305
  }
306
306
  // getDeclaredTypeOfSymbol gets the INSTANCE type
307
307
  // getTypeOfSymbolAtLocation gets the STATIC type
308
308
  function convertClassOrInterface(context, symbol, exportSymbol) {
309
- const reflection = context.createDeclarationReflection(typescript_1.default.SymbolFlags.Class & symbol.flags
310
- ? models_1.ReflectionKind.Class
311
- : models_1.ReflectionKind.Interface, symbol, exportSymbol, void 0);
309
+ const reflection = context.createDeclarationReflection(ts.SymbolFlags.Class & symbol.flags
310
+ ? ReflectionKind.Class
311
+ : ReflectionKind.Interface, symbol, exportSymbol, void 0);
312
312
  const classDeclaration = symbol
313
313
  .getDeclarations()
314
- ?.find((d) => typescript_1.default.isClassDeclaration(d) || typescript_1.default.isFunctionDeclaration(d));
314
+ ?.find((d) => ts.isClassDeclaration(d) || ts.isFunctionDeclaration(d));
315
315
  if (classDeclaration)
316
316
  setModifiers(symbol, classDeclaration, reflection);
317
317
  const reflectionContext = context.withScope(reflection);
318
318
  reflectionContext.convertingClassOrInterface = true;
319
319
  const instanceType = context.checker.getDeclaredTypeOfSymbol(symbol);
320
- (0, assert_1.default)(instanceType.isClassOrInterface());
320
+ assert(instanceType.isClassOrInterface());
321
321
  // We might do some inheritance - do this first so that it's set when converting properties
322
322
  const declarations = symbol
323
323
  .getDeclarations()
324
- ?.filter((d) => typescript_1.default.isInterfaceDeclaration(d) || typescript_1.default.isClassDeclaration(d)) ?? [];
325
- const extendedTypes = (0, nodes_1.getHeritageTypes)(declarations, typescript_1.default.SyntaxKind.ExtendsKeyword).map((t) => context.converter.convertType(reflectionContext, t));
324
+ ?.filter((d) => ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) ?? [];
325
+ const extendedTypes = getHeritageTypes(declarations, ts.SyntaxKind.ExtendsKeyword).map((t) => context.converter.convertType(reflectionContext, t));
326
326
  if (extendedTypes.length) {
327
327
  reflection.extendedTypes = extendedTypes;
328
328
  }
329
- const implementedTypes = (0, nodes_1.getHeritageTypes)(declarations, typescript_1.default.SyntaxKind.ImplementsKeyword).map((t) => context.converter.convertType(reflectionContext, t));
329
+ const implementedTypes = getHeritageTypes(declarations, ts.SyntaxKind.ImplementsKeyword).map((t) => context.converter.convertType(reflectionContext, t));
330
330
  if (implementedTypes.length) {
331
331
  reflection.implementedTypes = implementedTypes;
332
332
  }
@@ -338,13 +338,13 @@ function convertClassOrInterface(context, symbol, exportSymbol) {
338
338
  for (const prop of context.checker.getPropertiesOfType(staticType)) {
339
339
  // Don't convert namespace members, or the prototype here.
340
340
  if (prop.flags &
341
- (typescript_1.default.SymbolFlags.ModuleMember | typescript_1.default.SymbolFlags.Prototype))
341
+ (ts.SymbolFlags.ModuleMember | ts.SymbolFlags.Prototype))
342
342
  continue;
343
343
  convertSymbol(reflectionContext, prop);
344
344
  }
345
345
  reflectionContext.shouldBeStatic = false;
346
346
  const ctors = staticType.getConstructSignatures();
347
- const constructMember = reflectionContext.createDeclarationReflection(models_1.ReflectionKind.Constructor, ctors[0]?.declaration?.symbol, void 0, "constructor");
347
+ const constructMember = reflectionContext.createDeclarationReflection(ReflectionKind.Constructor, ctors[0]?.declaration?.symbol, void 0, "constructor");
348
348
  // Modifiers are the same for all constructors
349
349
  if (ctors.length && ctors[0].declaration) {
350
350
  setModifiers(symbol, ctors[0].declaration, constructMember);
@@ -352,7 +352,7 @@ function convertClassOrInterface(context, symbol, exportSymbol) {
352
352
  context.finalizeDeclarationReflection(constructMember);
353
353
  const constructContext = reflectionContext.withScope(constructMember);
354
354
  ctors.forEach((sig) => {
355
- (0, signature_1.createSignature)(constructContext, models_1.ReflectionKind.ConstructorSignature, sig, symbol);
355
+ createSignature(constructContext, ReflectionKind.ConstructorSignature, sig, symbol);
356
356
  });
357
357
  }
358
358
  // Classes/interfaces usually just have properties...
@@ -361,119 +361,122 @@ function convertClassOrInterface(context, symbol, exportSymbol) {
361
361
  if (instanceType.typeParameters) {
362
362
  reflection.typeParameters = instanceType.typeParameters.map((param) => {
363
363
  const declaration = param.symbol.declarations?.[0];
364
- (0, assert_1.default)(declaration && typescript_1.default.isTypeParameterDeclaration(declaration));
365
- return (0, signature_1.createTypeParamReflection)(declaration, reflectionContext);
364
+ assert(declaration && ts.isTypeParameterDeclaration(declaration));
365
+ return createTypeParamReflection(declaration, reflectionContext);
366
366
  });
367
367
  }
368
368
  // Interfaces might also have call signatures
369
369
  // Classes might too, because of declaration merging
370
370
  context.checker
371
- .getSignaturesOfType(instanceType, typescript_1.default.SignatureKind.Call)
372
- .forEach((sig) => (0, signature_1.createSignature)(reflectionContext, models_1.ReflectionKind.CallSignature, sig, symbol));
371
+ .getSignaturesOfType(instanceType, ts.SignatureKind.Call)
372
+ .forEach((sig) => createSignature(reflectionContext, ReflectionKind.CallSignature, sig, symbol));
373
373
  // We also might have constructor signatures
374
374
  // This is potentially a problem with classes having multiple "constructor" members...
375
375
  // but nobody has complained yet.
376
376
  convertConstructSignatures(reflectionContext, symbol);
377
377
  // And finally, index signatures
378
- (0, index_signature_1.convertIndexSignatures)(reflectionContext, symbol);
378
+ convertIndexSignatures(reflectionContext, symbol);
379
379
  // Normally this shouldn't matter, unless someone did something with skipLibCheck on.
380
- return typescript_1.default.SymbolFlags.Alias;
380
+ return ts.SymbolFlags.Alias;
381
381
  }
382
382
  function convertProperty(context, symbol, exportSymbol) {
383
383
  // This might happen if we're converting a function-module created with Object.assign
384
384
  // or `export default () => {}`
385
- if (context.scope.kindOf(models_1.ReflectionKind.VariableContainer)) {
385
+ if (context.scope.kindOf(ReflectionKind.VariableContainer)) {
386
386
  return convertVariable(context, symbol, exportSymbol);
387
387
  }
388
388
  const declarations = symbol.getDeclarations() ?? [];
389
389
  // Don't do anything if we inherited this property and it is private.
390
390
  if (isInherited(context, symbol) &&
391
391
  declarations.length > 0 &&
392
- (0, enum_1.hasAllFlags)(typescript_1.default.getCombinedModifierFlags(declarations[0]), typescript_1.default.ModifierFlags.Private)) {
392
+ hasAllFlags(ts.getCombinedModifierFlags(declarations[0]), ts.ModifierFlags.Private)) {
393
393
  return;
394
394
  }
395
395
  // Special case: We pretend properties are methods if they look like methods.
396
396
  // This happens with mixins / weird inheritance.
397
397
  if (declarations.length &&
398
- declarations.every((decl) => typescript_1.default.isMethodSignature(decl) || typescript_1.default.isMethodDeclaration(decl))) {
398
+ declarations.every((decl) => ts.isMethodSignature(decl) || ts.isMethodDeclaration(decl))) {
399
399
  return convertFunctionOrMethod(context, symbol, exportSymbol);
400
400
  }
401
401
  if (declarations.length === 1) {
402
402
  const declaration = declarations[0];
403
403
  // Special case: "arrow methods" should be treated as methods.
404
- if (typescript_1.default.isPropertyDeclaration(declaration) &&
404
+ if (ts.isPropertyDeclaration(declaration) &&
405
405
  !declaration.type &&
406
406
  declaration.initializer &&
407
- typescript_1.default.isArrowFunction(declaration.initializer)) {
407
+ ts.isArrowFunction(declaration.initializer)) {
408
408
  return convertArrowAsMethod(context, symbol, declaration.initializer, exportSymbol);
409
409
  }
410
410
  }
411
- const reflection = context.createDeclarationReflection(context.scope.kindOf(models_1.ReflectionKind.VariableContainer)
412
- ? models_1.ReflectionKind.Variable
413
- : models_1.ReflectionKind.Property, symbol, exportSymbol);
411
+ const reflection = context.createDeclarationReflection(context.scope.kindOf(ReflectionKind.VariableContainer)
412
+ ? ReflectionKind.Variable
413
+ : ReflectionKind.Property, symbol, exportSymbol);
414
414
  const declaration = symbol.getDeclarations()?.[0];
415
415
  let parameterType;
416
416
  if (declaration &&
417
- (typescript_1.default.isPropertyDeclaration(declaration) ||
418
- typescript_1.default.isPropertySignature(declaration) ||
419
- typescript_1.default.isParameter(declaration) ||
420
- typescript_1.default.isPropertyAccessExpression(declaration) ||
421
- typescript_1.default.isPropertyAssignment(declaration))) {
422
- if (!typescript_1.default.isPropertyAccessExpression(declaration) &&
423
- !typescript_1.default.isPropertyAssignment(declaration)) {
417
+ (ts.isPropertyDeclaration(declaration) ||
418
+ ts.isPropertySignature(declaration) ||
419
+ ts.isParameter(declaration) ||
420
+ ts.isPropertyAccessExpression(declaration) ||
421
+ ts.isPropertyAssignment(declaration))) {
422
+ if (!ts.isPropertyAccessExpression(declaration) &&
423
+ !ts.isPropertyAssignment(declaration)) {
424
424
  parameterType = declaration.type;
425
425
  }
426
426
  setModifiers(symbol, declaration, reflection);
427
427
  }
428
- reflection.defaultValue = declaration && (0, convert_expression_1.convertDefaultValue)(declaration);
428
+ else {
429
+ setSymbolModifiers(symbol, reflection);
430
+ }
431
+ reflection.defaultValue = declaration && convertDefaultValue(declaration);
429
432
  reflection.type = context.converter.convertType(context.withScope(reflection), (context.convertingTypeNode ? parameterType : void 0) ??
430
433
  context.checker.getTypeOfSymbol(symbol));
431
434
  if (reflection.flags.isOptional) {
432
- reflection.type = (0, reflections_1.removeUndefined)(reflection.type);
435
+ reflection.type = removeUndefined(reflection.type);
433
436
  }
434
437
  context.finalizeDeclarationReflection(reflection);
435
438
  }
436
439
  function convertArrowAsMethod(context, symbol, arrow, exportSymbol) {
437
- const reflection = context.createDeclarationReflection(models_1.ReflectionKind.Method, symbol, exportSymbol, void 0);
440
+ const reflection = context.createDeclarationReflection(ReflectionKind.Method, symbol, exportSymbol, void 0);
438
441
  setModifiers(symbol, arrow.parent, reflection);
439
442
  context.finalizeDeclarationReflection(reflection);
440
443
  const rc = context.withScope(reflection);
441
444
  const locationDeclaration = symbol.parent
442
445
  ?.getDeclarations()
443
- ?.find((d) => typescript_1.default.isClassDeclaration(d) || typescript_1.default.isInterfaceDeclaration(d)) ??
446
+ ?.find((d) => ts.isClassDeclaration(d) || ts.isInterfaceDeclaration(d)) ??
444
447
  symbol.parent?.getDeclarations()?.[0]?.getSourceFile() ??
445
448
  symbol.getDeclarations()?.[0]?.getSourceFile();
446
- (0, assert_1.default)(locationDeclaration, "Missing declaration context");
449
+ assert(locationDeclaration, "Missing declaration context");
447
450
  const type = context.checker.getTypeOfSymbolAtLocation(symbol, locationDeclaration);
448
451
  const signatures = type.getNonNullableType().getCallSignatures();
449
- (0, assert_1.default)(signatures.length, "Missing signatures");
450
- (0, signature_1.createSignature)(rc, models_1.ReflectionKind.CallSignature, signatures[0], symbol, arrow);
452
+ assert(signatures.length, "Missing signatures");
453
+ createSignature(rc, ReflectionKind.CallSignature, signatures[0], symbol, arrow);
451
454
  }
452
455
  function convertConstructor(context, symbol) {
453
- const reflection = context.createDeclarationReflection(models_1.ReflectionKind.Constructor, symbol, void 0, "constructor");
456
+ const reflection = context.createDeclarationReflection(ReflectionKind.Constructor, symbol, void 0, "constructor");
454
457
  context.finalizeDeclarationReflection(reflection);
455
458
  const reflectionContext = context.withScope(reflection);
456
- const declarations = symbol.getDeclarations()?.filter(typescript_1.default.isConstructorDeclaration) ?? [];
459
+ const declarations = symbol.getDeclarations()?.filter(ts.isConstructorDeclaration) ?? [];
457
460
  const signatures = declarations.map((decl) => {
458
461
  const sig = context.checker.getSignatureFromDeclaration(decl);
459
- (0, assert_1.default)(sig);
462
+ assert(sig);
460
463
  return sig;
461
464
  });
462
465
  for (const sig of signatures) {
463
- (0, signature_1.createSignature)(reflectionContext, models_1.ReflectionKind.ConstructorSignature, sig, symbol);
466
+ createSignature(reflectionContext, ReflectionKind.ConstructorSignature, sig, symbol);
464
467
  }
465
468
  }
466
469
  function convertConstructSignatures(context, symbol) {
467
470
  const type = context.checker.getDeclaredTypeOfSymbol(symbol);
468
471
  // These get added as a "constructor" member of this interface. This is a problem... but nobody
469
472
  // has complained yet. We really ought to have a constructSignatures property on the reflection instead.
470
- const constructSignatures = context.checker.getSignaturesOfType(type, typescript_1.default.SignatureKind.Construct);
473
+ const constructSignatures = context.checker.getSignaturesOfType(type, ts.SignatureKind.Construct);
471
474
  if (constructSignatures.length) {
472
- const constructMember = new models_1.DeclarationReflection("constructor", models_1.ReflectionKind.Constructor, context.scope);
475
+ const constructMember = new DeclarationReflection("constructor", ReflectionKind.Constructor, context.scope);
473
476
  context.postReflectionCreation(constructMember, symbol, void 0);
474
477
  context.finalizeDeclarationReflection(constructMember);
475
478
  const constructContext = context.withScope(constructMember);
476
- constructSignatures.forEach((sig) => (0, signature_1.createSignature)(constructContext, models_1.ReflectionKind.ConstructorSignature, sig, symbol));
479
+ constructSignatures.forEach((sig) => createSignature(constructContext, ReflectionKind.ConstructorSignature, sig, symbol));
477
480
  }
478
481
  }
479
482
  function convertAlias(context, symbol, exportSymbol) {
@@ -490,13 +493,13 @@ function createAlias(target, context, symbol, exportSymbol) {
490
493
  if (context.converter.excludeReferences)
491
494
  return;
492
495
  // We already have this. Create a reference.
493
- const ref = new models_1.ReferenceReflection(exportSymbol?.name ?? symbol.name, target, context.scope);
496
+ const ref = new ReferenceReflection(exportSymbol?.name ?? symbol.name, target, context.scope);
494
497
  context.postReflectionCreation(ref, symbol, exportSymbol);
495
498
  context.finalizeDeclarationReflection(ref);
496
499
  }
497
500
  function convertVariable(context, symbol, exportSymbol) {
498
501
  const declaration = symbol.getDeclarations()?.[0];
499
- const comment = context.getComment(symbol, models_1.ReflectionKind.Variable);
502
+ const comment = context.getComment(symbol, ReflectionKind.Variable);
500
503
  const type = declaration
501
504
  ? context.checker.getTypeOfSymbolAtLocation(symbol, declaration)
502
505
  : context.checker.getTypeOfSymbol(symbol);
@@ -514,22 +517,22 @@ function convertVariable(context, symbol, exportSymbol) {
514
517
  !type.getConstructSignatures().length) {
515
518
  return convertVariableAsFunction(context, symbol, exportSymbol);
516
519
  }
517
- const reflection = context.createDeclarationReflection(context.scope.kindOf(models_1.ReflectionKind.VariableContainer)
518
- ? models_1.ReflectionKind.Variable
519
- : models_1.ReflectionKind.Property, symbol, exportSymbol);
520
+ const reflection = context.createDeclarationReflection(context.scope.kindOf(ReflectionKind.VariableContainer)
521
+ ? ReflectionKind.Variable
522
+ : ReflectionKind.Property, symbol, exportSymbol);
520
523
  let typeNode;
521
- if (declaration && typescript_1.default.isVariableDeclaration(declaration)) {
524
+ if (declaration && ts.isVariableDeclaration(declaration)) {
522
525
  // Otherwise we might have destructuring
523
526
  typeNode = declaration.type;
524
527
  }
525
528
  reflection.type = context.converter.convertType(context.withScope(reflection), typeNode ?? type);
526
529
  setModifiers(symbol, declaration, reflection);
527
- reflection.defaultValue = (0, convert_expression_1.convertDefaultValue)(declaration);
530
+ reflection.defaultValue = convertDefaultValue(declaration);
528
531
  context.finalizeDeclarationReflection(reflection);
529
- return typescript_1.default.SymbolFlags.Property;
532
+ return ts.SymbolFlags.Property;
530
533
  }
531
534
  function isEnumLike(checker, type, location) {
532
- if (!location || !(0, enum_1.hasAllFlags)(type.flags, typescript_1.default.TypeFlags.Object)) {
535
+ if (!location || !hasAllFlags(type.flags, ts.TypeFlags.Object)) {
533
536
  return false;
534
537
  }
535
538
  return type.getProperties().every((prop) => {
@@ -538,51 +541,51 @@ function isEnumLike(checker, type, location) {
538
541
  });
539
542
  }
540
543
  function isValidEnumProperty(type) {
541
- return (0, enum_1.hasAnyFlag)(type.flags, typescript_1.default.TypeFlags.NumberLike | typescript_1.default.TypeFlags.StringLike);
544
+ return hasAnyFlag(type.flags, ts.TypeFlags.NumberLike | ts.TypeFlags.StringLike);
542
545
  }
543
546
  function convertVariableAsEnum(context, symbol, exportSymbol) {
544
- const reflection = context.createDeclarationReflection(models_1.ReflectionKind.Enum, symbol, exportSymbol);
547
+ const reflection = context.createDeclarationReflection(ReflectionKind.Enum, symbol, exportSymbol);
545
548
  context.finalizeDeclarationReflection(reflection);
546
549
  const rc = context.withScope(reflection);
547
- const declaration = symbol.declarations[0];
550
+ const declaration = symbol.declarations.find(ts.isVariableDeclaration);
548
551
  const type = context.checker.getTypeAtLocation(declaration);
549
552
  for (const prop of type.getProperties()) {
550
- const reflection = rc.createDeclarationReflection(models_1.ReflectionKind.EnumMember, prop, void 0);
553
+ const reflection = rc.createDeclarationReflection(ReflectionKind.EnumMember, prop, void 0);
551
554
  const propType = context.checker.getTypeOfSymbolAtLocation(prop, declaration);
552
- reflection.type = context.converter.convertType(context, propType);
555
+ reflection.type = context.converter.convertType(rc.withScope(reflection), propType);
553
556
  rc.finalizeDeclarationReflection(reflection);
554
557
  }
555
558
  // Skip converting the type alias, if there is one
556
- return typescript_1.default.SymbolFlags.TypeAlias;
559
+ return ts.SymbolFlags.TypeAlias;
557
560
  }
558
561
  function convertVariableAsNamespace(context, symbol, exportSymbol) {
559
- const reflection = context.createDeclarationReflection(models_1.ReflectionKind.Namespace, symbol, exportSymbol);
562
+ const reflection = context.createDeclarationReflection(ReflectionKind.Namespace, symbol, exportSymbol);
560
563
  context.finalizeDeclarationReflection(reflection);
561
564
  const rc = context.withScope(reflection);
562
565
  const type = context.checker.getTypeOfSymbol(symbol);
563
566
  convertSymbols(rc, type.getProperties());
564
- return typescript_1.default.SymbolFlags.Property;
567
+ return ts.SymbolFlags.Property;
565
568
  }
566
569
  function convertVariableAsFunction(context, symbol, exportSymbol) {
567
570
  const declaration = symbol
568
571
  .getDeclarations()
569
- ?.find(typescript_1.default.isVariableDeclaration);
572
+ ?.find(ts.isVariableDeclaration);
570
573
  const accessDeclaration = declaration ?? symbol.valueDeclaration;
571
574
  const type = accessDeclaration
572
575
  ? context.checker.getTypeOfSymbolAtLocation(symbol, accessDeclaration)
573
576
  : context.checker.getDeclaredTypeOfSymbol(symbol);
574
- const reflection = context.createDeclarationReflection(context.scope.kindOf(models_1.ReflectionKind.MethodContainer)
575
- ? models_1.ReflectionKind.Method
576
- : models_1.ReflectionKind.Function, symbol, exportSymbol);
577
+ const reflection = context.createDeclarationReflection(context.scope.kindOf(ReflectionKind.MethodContainer)
578
+ ? ReflectionKind.Method
579
+ : ReflectionKind.Function, symbol, exportSymbol);
577
580
  setModifiers(symbol, accessDeclaration, reflection);
578
581
  context.finalizeDeclarationReflection(reflection);
579
582
  const reflectionContext = context.withScope(reflection);
580
583
  reflection.signatures ??= [];
581
584
  for (const signature of type.getCallSignatures()) {
582
- (0, signature_1.createSignature)(reflectionContext, models_1.ReflectionKind.CallSignature, signature, symbol);
585
+ createSignature(reflectionContext, ReflectionKind.CallSignature, signature, symbol);
583
586
  }
584
587
  return (convertFunctionProperties(context.withScope(reflection), symbol, type) |
585
- typescript_1.default.SymbolFlags.Property);
588
+ ts.SymbolFlags.Property);
586
589
  }
587
590
  function convertFunctionProperties(context, symbol, type) {
588
591
  // #2436/#2461: Functions created with Object.assign on a function likely have properties
@@ -592,17 +595,17 @@ function convertFunctionProperties(context, symbol, type) {
592
595
  // rather than creating a separate namespace.
593
596
  // In the expando case, we'll have both namespace flags.
594
597
  // In the Object.assign case, we'll have no namespace flags.
595
- const nsFlags = typescript_1.default.SymbolFlags.ValueModule | typescript_1.default.SymbolFlags.NamespaceModule;
598
+ const nsFlags = ts.SymbolFlags.ValueModule | ts.SymbolFlags.NamespaceModule;
596
599
  if (type.getProperties().length &&
597
- ((0, enum_1.hasAllFlags)(symbol.flags, nsFlags) ||
598
- !(0, enum_1.hasAnyFlag)(symbol.flags, nsFlags))) {
600
+ (hasAllFlags(symbol.flags, nsFlags) ||
601
+ !hasAnyFlag(symbol.flags, nsFlags))) {
599
602
  convertSymbols(context, type.getProperties());
600
- return typescript_1.default.SymbolFlags.NamespaceModule;
603
+ return ts.SymbolFlags.NamespaceModule;
601
604
  }
602
- return typescript_1.default.SymbolFlags.None;
605
+ return ts.SymbolFlags.None;
603
606
  }
604
607
  function convertSymbolAsClass(context, symbol, exportSymbol) {
605
- const reflection = context.createDeclarationReflection(models_1.ReflectionKind.Class, symbol, exportSymbol);
608
+ const reflection = context.createDeclarationReflection(ReflectionKind.Class, symbol, exportSymbol);
606
609
  const rc = context.withScope(reflection);
607
610
  context.finalizeDeclarationReflection(reflection);
608
611
  if (!symbol.valueDeclaration) {
@@ -615,12 +618,12 @@ function convertSymbolAsClass(context, symbol, exportSymbol) {
615
618
  // Prototype is implicitly this class, don't document it.
616
619
  type.getProperties().filter((prop) => prop.name !== "prototype"));
617
620
  for (const sig of type.getCallSignatures()) {
618
- (0, signature_1.createSignature)(rc, models_1.ReflectionKind.CallSignature, sig, undefined);
621
+ createSignature(rc, ReflectionKind.CallSignature, sig, undefined);
619
622
  }
620
623
  rc.shouldBeStatic = false;
621
624
  const ctors = type.getConstructSignatures();
622
625
  if (ctors.length) {
623
- const constructMember = rc.createDeclarationReflection(models_1.ReflectionKind.Constructor, ctors[0]?.declaration?.symbol, void 0, "constructor");
626
+ const constructMember = rc.createDeclarationReflection(ReflectionKind.Constructor, ctors[0]?.declaration?.symbol, void 0, "constructor");
624
627
  // Modifiers are the same for all constructors
625
628
  if (ctors.length && ctors[0].declaration) {
626
629
  setModifiers(symbol, ctors[0].declaration, constructMember);
@@ -628,41 +631,41 @@ function convertSymbolAsClass(context, symbol, exportSymbol) {
628
631
  context.finalizeDeclarationReflection(constructMember);
629
632
  const constructContext = rc.withScope(constructMember);
630
633
  for (const sig of ctors) {
631
- (0, signature_1.createConstructSignatureWithType)(constructContext, sig, reflection);
634
+ createConstructSignatureWithType(constructContext, sig, reflection);
632
635
  }
633
636
  const instType = ctors[0].getReturnType();
634
637
  convertSymbols(rc, instType.getProperties());
635
638
  for (const sig of instType.getCallSignatures()) {
636
- (0, signature_1.createSignature)(rc, models_1.ReflectionKind.CallSignature, sig, undefined);
639
+ createSignature(rc, ReflectionKind.CallSignature, sig, undefined);
637
640
  }
638
641
  }
639
642
  else {
640
643
  context.logger.warn(context.i18n.converting_0_as_class_without_construct_signatures(reflection.getFriendlyFullName()), symbol.valueDeclaration);
641
644
  }
642
- return (typescript_1.default.SymbolFlags.TypeAlias |
643
- typescript_1.default.SymbolFlags.Interface |
644
- typescript_1.default.SymbolFlags.Namespace);
645
+ return (ts.SymbolFlags.TypeAlias |
646
+ ts.SymbolFlags.Interface |
647
+ ts.SymbolFlags.Namespace);
645
648
  }
646
649
  function convertAccessor(context, symbol, exportSymbol) {
647
- const reflection = context.createDeclarationReflection(models_1.ReflectionKind.Accessor, symbol, exportSymbol);
650
+ const reflection = context.createDeclarationReflection(ReflectionKind.Accessor, symbol, exportSymbol);
648
651
  const rc = context.withScope(reflection);
649
652
  const declaration = symbol.getDeclarations()?.[0];
650
653
  if (declaration) {
651
654
  setModifiers(symbol, declaration, reflection);
652
655
  }
653
656
  context.finalizeDeclarationReflection(reflection);
654
- const getDeclaration = symbol.getDeclarations()?.find(typescript_1.default.isGetAccessor);
657
+ const getDeclaration = symbol.getDeclarations()?.find(ts.isGetAccessor);
655
658
  if (getDeclaration) {
656
659
  const signature = context.checker.getSignatureFromDeclaration(getDeclaration);
657
660
  if (signature) {
658
- (0, signature_1.createSignature)(rc, models_1.ReflectionKind.GetSignature, signature, symbol, getDeclaration);
661
+ createSignature(rc, ReflectionKind.GetSignature, signature, symbol, getDeclaration);
659
662
  }
660
663
  }
661
- const setDeclaration = symbol.getDeclarations()?.find(typescript_1.default.isSetAccessor);
664
+ const setDeclaration = symbol.getDeclarations()?.find(ts.isSetAccessor);
662
665
  if (setDeclaration) {
663
666
  const signature = context.checker.getSignatureFromDeclaration(setDeclaration);
664
667
  if (signature) {
665
- (0, signature_1.createSignature)(rc, models_1.ReflectionKind.SetSignature, signature, symbol, setDeclaration);
668
+ createSignature(rc, ReflectionKind.SetSignature, signature, symbol, setDeclaration);
666
669
  }
667
670
  }
668
671
  }
@@ -673,41 +676,45 @@ function isInherited(context, symbol) {
673
676
  if (!parentSymbol)
674
677
  return false;
675
678
  const parents = parentSymbol.declarations?.slice() || [];
676
- const constructorDecls = parents.flatMap((parent) => typescript_1.default.isClassDeclaration(parent)
677
- ? parent.members.filter(typescript_1.default.isConstructorDeclaration)
679
+ const constructorDecls = parents.flatMap((parent) => ts.isClassDeclaration(parent)
680
+ ? parent.members.filter(ts.isConstructorDeclaration)
678
681
  : []);
679
682
  parents.push(...constructorDecls);
680
683
  return (parents.some((d) => symbol.getDeclarations()?.some((d2) => d2.parent === d)) === false);
681
684
  }
682
685
  function setModifiers(symbol, declaration, reflection) {
686
+ setSymbolModifiers(symbol, reflection);
683
687
  if (!declaration) {
684
688
  return;
685
689
  }
686
- const modifiers = typescript_1.default.getCombinedModifierFlags(declaration);
687
- if (typescript_1.default.isMethodDeclaration(declaration) ||
688
- typescript_1.default.isPropertyDeclaration(declaration) ||
689
- typescript_1.default.isAccessor(declaration)) {
690
- if (typescript_1.default.isPrivateIdentifier(declaration.name)) {
691
- reflection.setFlag(models_1.ReflectionFlag.Private);
690
+ const modifiers = ts.getCombinedModifierFlags(declaration);
691
+ if (ts.isMethodDeclaration(declaration) ||
692
+ ts.isPropertyDeclaration(declaration) ||
693
+ ts.isAccessor(declaration)) {
694
+ if (ts.isPrivateIdentifier(declaration.name)) {
695
+ reflection.setFlag(ReflectionFlag.Private);
692
696
  }
693
697
  }
694
- if ((0, enum_1.hasAllFlags)(modifiers, typescript_1.default.ModifierFlags.Private)) {
695
- reflection.setFlag(models_1.ReflectionFlag.Private);
698
+ if (hasAllFlags(modifiers, ts.ModifierFlags.Private)) {
699
+ reflection.setFlag(ReflectionFlag.Private);
696
700
  }
697
- if ((0, enum_1.hasAllFlags)(modifiers, typescript_1.default.ModifierFlags.Protected)) {
698
- reflection.setFlag(models_1.ReflectionFlag.Protected);
701
+ if (hasAllFlags(modifiers, ts.ModifierFlags.Protected)) {
702
+ reflection.setFlag(ReflectionFlag.Protected);
699
703
  }
700
- if ((0, enum_1.hasAllFlags)(modifiers, typescript_1.default.ModifierFlags.Public)) {
701
- reflection.setFlag(models_1.ReflectionFlag.Public);
704
+ if (hasAllFlags(modifiers, ts.ModifierFlags.Public)) {
705
+ reflection.setFlag(ReflectionFlag.Public);
702
706
  }
703
- reflection.setFlag(models_1.ReflectionFlag.Optional, (0, enum_1.hasAllFlags)(symbol.flags, typescript_1.default.SymbolFlags.Optional));
704
- reflection.setFlag(models_1.ReflectionFlag.Readonly, (0, enum_1.hasAllFlags)(typescript_1.default.getCheckFlags(symbol), typescript_1.default.CheckFlags.Readonly) ||
705
- (0, enum_1.hasAllFlags)(modifiers, typescript_1.default.ModifierFlags.Readonly));
706
- reflection.setFlag(models_1.ReflectionFlag.Abstract, (0, enum_1.hasAllFlags)(modifiers, typescript_1.default.ModifierFlags.Abstract));
707
- if (reflection.kindOf(models_1.ReflectionKind.Variable) &&
708
- (0, enum_1.hasAllFlags)(symbol.flags, typescript_1.default.SymbolFlags.BlockScopedVariable)) {
709
- reflection.setFlag(models_1.ReflectionFlag.Const, (0, enum_1.hasAllFlags)(declaration.parent.flags, typescript_1.default.NodeFlags.Const));
707
+ reflection.setFlag(ReflectionFlag.Optional, hasAllFlags(symbol.flags, ts.SymbolFlags.Optional));
708
+ reflection.setFlag(ReflectionFlag.Readonly, hasAllFlags(ts.getCheckFlags(symbol), ts.CheckFlags.Readonly) ||
709
+ hasAllFlags(modifiers, ts.ModifierFlags.Readonly));
710
+ reflection.setFlag(ReflectionFlag.Abstract, hasAllFlags(modifiers, ts.ModifierFlags.Abstract));
711
+ if (reflection.kindOf(ReflectionKind.Variable) &&
712
+ hasAllFlags(symbol.flags, ts.SymbolFlags.BlockScopedVariable)) {
713
+ reflection.setFlag(ReflectionFlag.Const, hasAllFlags(declaration.parent.flags, ts.NodeFlags.Const));
710
714
  }
711
715
  // ReflectionFlag.Static happens when constructing the reflection.
712
716
  // We don't have sufficient information here to determine if it ought to be static.
713
717
  }
718
+ function setSymbolModifiers(symbol, reflection) {
719
+ reflection.setFlag(ReflectionFlag.Optional, hasAllFlags(symbol.flags, ts.SymbolFlags.Optional));
720
+ }