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,23 +1,16 @@
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.loadConverters = loadConverters;
7
- exports.convertType = convertType;
8
- const assert_1 = __importDefault(require("assert"));
9
- const typescript_1 = __importDefault(require("typescript"));
10
- const models_1 = require("../models");
11
- const ReflectionSymbolId_1 = require("../models/reflections/ReflectionSymbolId");
12
- const array_1 = require("../utils/array");
13
- const converter_events_1 = require("./converter-events");
14
- const index_signature_1 = require("./factories/index-signature");
15
- const signature_1 = require("./factories/signature");
16
- const symbols_1 = require("./symbols");
17
- const nodes_1 = require("./utils/nodes");
18
- const reflections_1 = require("./utils/reflections");
1
+ import assert from "assert";
2
+ import ts from "typescript";
3
+ import { ArrayType, ConditionalType, DeclarationReflection, IndexedAccessType, InferredType, IntersectionType, IntrinsicType, NamedTupleMember, PredicateType, QueryType, ReferenceType, ReflectionKind, ReflectionType, LiteralType, TupleType, TypeOperatorType, UnionType, UnknownType, MappedType, SignatureReflection, ReflectionFlag, OptionalType, RestType, TemplateLiteralType, } from "../models/index.js";
4
+ import { ReflectionSymbolId } from "../models/reflections/ReflectionSymbolId.js";
5
+ import { zip } from "../utils/array.js";
6
+ import { ConverterEvents } from "./converter-events.js";
7
+ import { convertIndexSignatures } from "./factories/index-signature.js";
8
+ import { convertParameterNodes, convertTypeParameterNodes, createSignature, } from "./factories/signature.js";
9
+ import { convertSymbol } from "./symbols.js";
10
+ import { isObjectType } from "./utils/nodes.js";
11
+ import { removeUndefined } from "./utils/reflections.js";
19
12
  const converters = new Map();
20
- function loadConverters() {
13
+ export function loadConverters() {
21
14
  if (converters.size)
22
15
  return;
23
16
  for (const actor of [
@@ -57,7 +50,7 @@ function loadConverters() {
57
50
  // Might happen if running on an older TS version.
58
51
  continue;
59
52
  }
60
- (0, assert_1.default)(!converters.has(key));
53
+ assert(!converters.has(key));
61
54
  converters.set(key, actor);
62
55
  }
63
56
  }
@@ -72,12 +65,12 @@ function maybeConvertType(context, typeOrNode) {
72
65
  return convertType(context, typeOrNode);
73
66
  }
74
67
  let typeConversionDepth = 0;
75
- function convertType(context, typeOrNode) {
68
+ export function convertType(context, typeOrNode) {
76
69
  if (!typeOrNode) {
77
- return new models_1.IntrinsicType("any");
70
+ return new IntrinsicType("any");
78
71
  }
79
72
  if (typeConversionDepth > context.converter.maxTypeConversionDepth) {
80
- return new models_1.UnknownType("...");
73
+ return new UnknownType("...");
81
74
  }
82
75
  loadConverters();
83
76
  if ("kind" in typeOrNode) {
@@ -99,12 +92,12 @@ function convertType(context, typeOrNode) {
99
92
  return convertType(context, typeOrNode.origin);
100
93
  }
101
94
  // IgnoreErrors is important, without it, we can't assert that we will get a node.
102
- const node = context.checker.typeToTypeNode(typeOrNode, void 0, typescript_1.default.NodeBuilderFlags.IgnoreErrors);
103
- (0, assert_1.default)(node); // According to the TS source of typeToString, this is a bug if it does not hold.
95
+ const node = context.checker.typeToTypeNode(typeOrNode, void 0, ts.NodeBuilderFlags.IgnoreErrors);
96
+ assert(node); // According to the TS source of typeToString, this is a bug if it does not hold.
104
97
  if (seenTypes.has(typeOrNode.id)) {
105
98
  const typeString = context.checker.typeToString(typeOrNode);
106
99
  context.logger.verbose(`Refusing to recurse when converting type: ${typeString}`);
107
- return new models_1.UnknownType(typeString);
100
+ return new UnknownType(typeString);
108
101
  }
109
102
  let converter = converters.get(node.kind);
110
103
  if (converter) {
@@ -123,70 +116,70 @@ function convertType(context, typeOrNode) {
123
116
  return requestBugReport(context, typeOrNode);
124
117
  }
125
118
  const arrayConverter = {
126
- kind: [typescript_1.default.SyntaxKind.ArrayType],
119
+ kind: [ts.SyntaxKind.ArrayType],
127
120
  convert(context, node) {
128
- return new models_1.ArrayType(convertType(context, node.elementType));
121
+ return new ArrayType(convertType(context, node.elementType));
129
122
  },
130
123
  convertType(context, type) {
131
124
  const params = context.checker.getTypeArguments(type);
132
125
  // This is *almost* always true... except for when this type is in the constraint of a type parameter see GH#1408
133
126
  // assert(params.length === 1);
134
- (0, assert_1.default)(params.length > 0);
135
- return new models_1.ArrayType(convertType(context, params[0]));
127
+ assert(params.length > 0);
128
+ return new ArrayType(convertType(context, params[0]));
136
129
  },
137
130
  };
138
131
  const conditionalConverter = {
139
- kind: [typescript_1.default.SyntaxKind.ConditionalType],
132
+ kind: [ts.SyntaxKind.ConditionalType],
140
133
  convert(context, node) {
141
- return new models_1.ConditionalType(convertType(context, node.checkType), convertType(context, node.extendsType), convertType(context, node.trueType), convertType(context, node.falseType));
134
+ return new ConditionalType(convertType(context, node.checkType), convertType(context, node.extendsType), convertType(context, node.trueType), convertType(context, node.falseType));
142
135
  },
143
136
  convertType(context, type) {
144
- return new models_1.ConditionalType(convertType(context, type.checkType), convertType(context, type.extendsType), convertType(context, type.resolvedTrueType), convertType(context, type.resolvedFalseType));
137
+ return new ConditionalType(convertType(context, type.checkType), convertType(context, type.extendsType), convertType(context, type.resolvedTrueType), convertType(context, type.resolvedFalseType));
145
138
  },
146
139
  };
147
140
  const constructorConverter = {
148
- kind: [typescript_1.default.SyntaxKind.ConstructorType],
141
+ kind: [ts.SyntaxKind.ConstructorType],
149
142
  convert(context, node) {
150
143
  const symbol = context.getSymbolAtLocation(node) ?? node.symbol;
151
144
  const type = context.getTypeAtLocation(node);
152
145
  if (!symbol || !type) {
153
- return new models_1.IntrinsicType("Function");
146
+ return new IntrinsicType("Function");
154
147
  }
155
- const reflection = new models_1.DeclarationReflection("__type", models_1.ReflectionKind.Constructor, context.scope);
148
+ const reflection = new DeclarationReflection("__type", ReflectionKind.Constructor, context.scope);
156
149
  const rc = context.withScope(reflection);
157
150
  rc.convertingTypeNode = true;
158
151
  context.registerReflection(reflection, symbol);
159
- context.converter.trigger(converter_events_1.ConverterEvents.CREATE_DECLARATION, context, reflection);
160
- const signature = new models_1.SignatureReflection("__type", models_1.ReflectionKind.ConstructorSignature, reflection);
152
+ context.converter.trigger(ConverterEvents.CREATE_DECLARATION, context, reflection);
153
+ const signature = new SignatureReflection("__type", ReflectionKind.ConstructorSignature, reflection);
161
154
  // This is unfortunate... but seems the obvious place to put this with the current
162
155
  // architecture. Ideally, this would be a property on a "ConstructorType"... but that
163
156
  // needs to wait until TypeDoc 0.22 when making other breaking changes.
164
- if (node.modifiers?.some((m) => m.kind === typescript_1.default.SyntaxKind.AbstractKeyword)) {
165
- signature.setFlag(models_1.ReflectionFlag.Abstract);
157
+ if (node.modifiers?.some((m) => m.kind === ts.SyntaxKind.AbstractKeyword)) {
158
+ signature.setFlag(ReflectionFlag.Abstract);
166
159
  }
167
- context.project.registerSymbolId(signature, new ReflectionSymbolId_1.ReflectionSymbolId(symbol, node));
160
+ context.project.registerSymbolId(signature, new ReflectionSymbolId(symbol, node));
168
161
  context.registerReflection(signature, void 0);
169
162
  const signatureCtx = rc.withScope(signature);
170
163
  reflection.signatures = [signature];
171
164
  signature.type = convertType(signatureCtx, node.type);
172
- signature.parameters = (0, signature_1.convertParameterNodes)(signatureCtx, signature, node.parameters);
173
- signature.typeParameters = (0, signature_1.convertTypeParameterNodes)(signatureCtx, node.typeParameters);
174
- return new models_1.ReflectionType(reflection);
165
+ signature.parameters = convertParameterNodes(signatureCtx, signature, node.parameters);
166
+ signature.typeParameters = convertTypeParameterNodes(signatureCtx, node.typeParameters);
167
+ return new ReflectionType(reflection);
175
168
  },
176
169
  convertType(context, type) {
177
170
  const symbol = type.getSymbol();
178
171
  if (!symbol) {
179
- return new models_1.IntrinsicType("Function");
172
+ return new IntrinsicType("Function");
180
173
  }
181
- const reflection = new models_1.DeclarationReflection("__type", models_1.ReflectionKind.Constructor, context.scope);
174
+ const reflection = new DeclarationReflection("__type", ReflectionKind.Constructor, context.scope);
182
175
  context.registerReflection(reflection, symbol);
183
- context.converter.trigger(converter_events_1.ConverterEvents.CREATE_DECLARATION, context, reflection);
184
- (0, signature_1.createSignature)(context.withScope(reflection), models_1.ReflectionKind.ConstructorSignature, type.getConstructSignatures()[0], symbol);
185
- return new models_1.ReflectionType(reflection);
176
+ context.converter.trigger(ConverterEvents.CREATE_DECLARATION, context, reflection);
177
+ createSignature(context.withScope(reflection), ReflectionKind.ConstructorSignature, type.getConstructSignatures()[0], symbol);
178
+ return new ReflectionType(reflection);
186
179
  },
187
180
  };
188
181
  const exprWithTypeArgsConverter = {
189
- kind: [typescript_1.default.SyntaxKind.ExpressionWithTypeArguments],
182
+ kind: [ts.SyntaxKind.ExpressionWithTypeArguments],
190
183
  convert(context, node) {
191
184
  const targetSymbol = context.getSymbolAtLocation(node.expression);
192
185
  // Mixins... we might not have a symbol here.
@@ -194,149 +187,149 @@ const exprWithTypeArgsConverter = {
194
187
  return convertType(context, context.checker.getTypeAtLocation(node));
195
188
  }
196
189
  const parameters = node.typeArguments?.map((type) => convertType(context, type)) ?? [];
197
- const ref = models_1.ReferenceType.createSymbolReference(context.resolveAliasedSymbol(targetSymbol), context);
190
+ const ref = ReferenceType.createSymbolReference(context.resolveAliasedSymbol(targetSymbol), context);
198
191
  ref.typeArguments = parameters;
199
192
  return ref;
200
193
  },
201
194
  convertType: requestBugReport,
202
195
  };
203
196
  const functionTypeConverter = {
204
- kind: [typescript_1.default.SyntaxKind.FunctionType],
197
+ kind: [ts.SyntaxKind.FunctionType],
205
198
  convert(context, node) {
206
199
  const symbol = context.getSymbolAtLocation(node) ?? node.symbol;
207
200
  const type = context.getTypeAtLocation(node);
208
201
  if (!symbol || !type) {
209
- return new models_1.IntrinsicType("Function");
202
+ return new IntrinsicType("Function");
210
203
  }
211
- const reflection = new models_1.DeclarationReflection("__type", models_1.ReflectionKind.TypeLiteral, context.scope);
204
+ const reflection = new DeclarationReflection("__type", ReflectionKind.TypeLiteral, context.scope);
212
205
  const rc = context.withScope(reflection);
213
206
  context.registerReflection(reflection, symbol);
214
- context.converter.trigger(converter_events_1.ConverterEvents.CREATE_DECLARATION, context, reflection);
215
- const signature = new models_1.SignatureReflection("__type", models_1.ReflectionKind.CallSignature, reflection);
216
- context.project.registerSymbolId(signature, new ReflectionSymbolId_1.ReflectionSymbolId(symbol, node));
207
+ context.converter.trigger(ConverterEvents.CREATE_DECLARATION, context, reflection);
208
+ const signature = new SignatureReflection("__type", ReflectionKind.CallSignature, reflection);
209
+ context.project.registerSymbolId(signature, new ReflectionSymbolId(symbol, node));
217
210
  context.registerReflection(signature, undefined);
218
211
  const signatureCtx = rc.withScope(signature);
219
212
  reflection.signatures = [signature];
220
213
  signature.type = convertType(signatureCtx, node.type);
221
- signature.parameters = (0, signature_1.convertParameterNodes)(signatureCtx, signature, node.parameters);
222
- signature.typeParameters = (0, signature_1.convertTypeParameterNodes)(signatureCtx, node.typeParameters);
223
- return new models_1.ReflectionType(reflection);
214
+ signature.parameters = convertParameterNodes(signatureCtx, signature, node.parameters);
215
+ signature.typeParameters = convertTypeParameterNodes(signatureCtx, node.typeParameters);
216
+ return new ReflectionType(reflection);
224
217
  },
225
218
  convertType(context, type) {
226
219
  const symbol = type.getSymbol();
227
220
  if (!symbol) {
228
- return new models_1.IntrinsicType("Function");
221
+ return new IntrinsicType("Function");
229
222
  }
230
- const reflection = new models_1.DeclarationReflection("__type", models_1.ReflectionKind.TypeLiteral, context.scope);
223
+ const reflection = new DeclarationReflection("__type", ReflectionKind.TypeLiteral, context.scope);
231
224
  context.registerReflection(reflection, symbol);
232
- context.converter.trigger(converter_events_1.ConverterEvents.CREATE_DECLARATION, context, reflection);
233
- (0, signature_1.createSignature)(context.withScope(reflection), models_1.ReflectionKind.CallSignature, type.getCallSignatures()[0], type.getSymbol());
234
- return new models_1.ReflectionType(reflection);
225
+ context.converter.trigger(ConverterEvents.CREATE_DECLARATION, context, reflection);
226
+ createSignature(context.withScope(reflection), ReflectionKind.CallSignature, type.getCallSignatures()[0], type.getSymbol());
227
+ return new ReflectionType(reflection);
235
228
  },
236
229
  };
237
230
  const importType = {
238
- kind: [typescript_1.default.SyntaxKind.ImportType],
231
+ kind: [ts.SyntaxKind.ImportType],
239
232
  convert(context, node) {
240
233
  const name = node.qualifier?.getText() ?? "__module";
241
234
  const symbol = context.checker.getSymbolAtLocation(node);
242
- (0, assert_1.default)(symbol, "Missing symbol when converting import type node");
243
- return models_1.ReferenceType.createSymbolReference(context.resolveAliasedSymbol(symbol), context, name);
235
+ assert(symbol, "Missing symbol when converting import type node");
236
+ return ReferenceType.createSymbolReference(context.resolveAliasedSymbol(symbol), context, name);
244
237
  },
245
238
  convertType(context, type) {
246
239
  const symbol = type.getSymbol();
247
- (0, assert_1.default)(symbol, "Missing symbol when converting import type"); // Should be a compiler error
248
- return models_1.ReferenceType.createSymbolReference(context.resolveAliasedSymbol(symbol), context, "__module");
240
+ assert(symbol, "Missing symbol when converting import type"); // Should be a compiler error
241
+ return ReferenceType.createSymbolReference(context.resolveAliasedSymbol(symbol), context, "__module");
249
242
  },
250
243
  };
251
244
  const indexedAccessConverter = {
252
- kind: [typescript_1.default.SyntaxKind.IndexedAccessType],
245
+ kind: [ts.SyntaxKind.IndexedAccessType],
253
246
  convert(context, node) {
254
- return new models_1.IndexedAccessType(convertType(context, node.objectType), convertType(context, node.indexType));
247
+ return new IndexedAccessType(convertType(context, node.objectType), convertType(context, node.indexType));
255
248
  },
256
249
  convertType(context, type) {
257
- return new models_1.IndexedAccessType(convertType(context, type.objectType), convertType(context, type.indexType));
250
+ return new IndexedAccessType(convertType(context, type.objectType), convertType(context, type.indexType));
258
251
  },
259
252
  };
260
253
  const inferredConverter = {
261
- kind: [typescript_1.default.SyntaxKind.InferType],
254
+ kind: [ts.SyntaxKind.InferType],
262
255
  convert(context, node) {
263
- return new models_1.InferredType(node.typeParameter.name.text, maybeConvertType(context, node.typeParameter.constraint));
256
+ return new InferredType(node.typeParameter.name.text, maybeConvertType(context, node.typeParameter.constraint));
264
257
  },
265
258
  convertType(context, type) {
266
- return new models_1.InferredType(type.getSymbol().name, maybeConvertType(context, type.getConstraint()));
259
+ return new InferredType(type.getSymbol().name, maybeConvertType(context, type.getConstraint()));
267
260
  },
268
261
  };
269
262
  const intersectionConverter = {
270
- kind: [typescript_1.default.SyntaxKind.IntersectionType],
263
+ kind: [ts.SyntaxKind.IntersectionType],
271
264
  convert(context, node) {
272
- return new models_1.IntersectionType(node.types.map((type) => convertType(context, type)));
265
+ return new IntersectionType(node.types.map((type) => convertType(context, type)));
273
266
  },
274
267
  convertType(context, type) {
275
- return new models_1.IntersectionType(type.types.map((type) => convertType(context, type)));
268
+ return new IntersectionType(type.types.map((type) => convertType(context, type)));
276
269
  },
277
270
  };
278
271
  const intrinsicConverter = {
279
- kind: [typescript_1.default.SyntaxKind.IntrinsicKeyword],
272
+ kind: [ts.SyntaxKind.IntrinsicKeyword],
280
273
  convert() {
281
- return new models_1.IntrinsicType("intrinsic");
274
+ return new IntrinsicType("intrinsic");
282
275
  },
283
276
  convertType() {
284
- return new models_1.IntrinsicType("intrinsic");
277
+ return new IntrinsicType("intrinsic");
285
278
  },
286
279
  };
287
280
  const jsDocVariadicTypeConverter = {
288
- kind: [typescript_1.default.SyntaxKind.JSDocVariadicType],
281
+ kind: [ts.SyntaxKind.JSDocVariadicType],
289
282
  convert(context, node) {
290
- return new models_1.ArrayType(convertType(context, node.type));
283
+ return new ArrayType(convertType(context, node.type));
291
284
  },
292
285
  // Should just be an ArrayType
293
286
  convertType: requestBugReport,
294
287
  };
295
288
  const keywordNames = {
296
- [typescript_1.default.SyntaxKind.AnyKeyword]: "any",
297
- [typescript_1.default.SyntaxKind.BigIntKeyword]: "bigint",
298
- [typescript_1.default.SyntaxKind.BooleanKeyword]: "boolean",
299
- [typescript_1.default.SyntaxKind.NeverKeyword]: "never",
300
- [typescript_1.default.SyntaxKind.NumberKeyword]: "number",
301
- [typescript_1.default.SyntaxKind.ObjectKeyword]: "object",
302
- [typescript_1.default.SyntaxKind.StringKeyword]: "string",
303
- [typescript_1.default.SyntaxKind.SymbolKeyword]: "symbol",
304
- [typescript_1.default.SyntaxKind.UndefinedKeyword]: "undefined",
305
- [typescript_1.default.SyntaxKind.UnknownKeyword]: "unknown",
306
- [typescript_1.default.SyntaxKind.VoidKeyword]: "void",
307
- [typescript_1.default.SyntaxKind.IntrinsicKeyword]: "intrinsic",
289
+ [ts.SyntaxKind.AnyKeyword]: "any",
290
+ [ts.SyntaxKind.BigIntKeyword]: "bigint",
291
+ [ts.SyntaxKind.BooleanKeyword]: "boolean",
292
+ [ts.SyntaxKind.NeverKeyword]: "never",
293
+ [ts.SyntaxKind.NumberKeyword]: "number",
294
+ [ts.SyntaxKind.ObjectKeyword]: "object",
295
+ [ts.SyntaxKind.StringKeyword]: "string",
296
+ [ts.SyntaxKind.SymbolKeyword]: "symbol",
297
+ [ts.SyntaxKind.UndefinedKeyword]: "undefined",
298
+ [ts.SyntaxKind.UnknownKeyword]: "unknown",
299
+ [ts.SyntaxKind.VoidKeyword]: "void",
300
+ [ts.SyntaxKind.IntrinsicKeyword]: "intrinsic",
308
301
  };
309
302
  const keywordConverter = {
310
303
  kind: [
311
- typescript_1.default.SyntaxKind.AnyKeyword,
312
- typescript_1.default.SyntaxKind.BigIntKeyword,
313
- typescript_1.default.SyntaxKind.BooleanKeyword,
314
- typescript_1.default.SyntaxKind.NeverKeyword,
315
- typescript_1.default.SyntaxKind.NumberKeyword,
316
- typescript_1.default.SyntaxKind.ObjectKeyword,
317
- typescript_1.default.SyntaxKind.StringKeyword,
318
- typescript_1.default.SyntaxKind.SymbolKeyword,
319
- typescript_1.default.SyntaxKind.UndefinedKeyword,
320
- typescript_1.default.SyntaxKind.UnknownKeyword,
321
- typescript_1.default.SyntaxKind.VoidKeyword,
304
+ ts.SyntaxKind.AnyKeyword,
305
+ ts.SyntaxKind.BigIntKeyword,
306
+ ts.SyntaxKind.BooleanKeyword,
307
+ ts.SyntaxKind.NeverKeyword,
308
+ ts.SyntaxKind.NumberKeyword,
309
+ ts.SyntaxKind.ObjectKeyword,
310
+ ts.SyntaxKind.StringKeyword,
311
+ ts.SyntaxKind.SymbolKeyword,
312
+ ts.SyntaxKind.UndefinedKeyword,
313
+ ts.SyntaxKind.UnknownKeyword,
314
+ ts.SyntaxKind.VoidKeyword,
322
315
  ],
323
316
  convert(_context, node) {
324
- return new models_1.IntrinsicType(keywordNames[node.kind]);
317
+ return new IntrinsicType(keywordNames[node.kind]);
325
318
  },
326
319
  convertType(_context, _type, node) {
327
- return new models_1.IntrinsicType(keywordNames[node.kind]);
320
+ return new IntrinsicType(keywordNames[node.kind]);
328
321
  },
329
322
  };
330
323
  const optionalConverter = {
331
- kind: [typescript_1.default.SyntaxKind.OptionalType],
324
+ kind: [ts.SyntaxKind.OptionalType],
332
325
  convert(context, node) {
333
- return new models_1.OptionalType((0, reflections_1.removeUndefined)(convertType(context, node.type)));
326
+ return new OptionalType(removeUndefined(convertType(context, node.type)));
334
327
  },
335
328
  // Handled by the tuple converter
336
329
  convertType: requestBugReport,
337
330
  };
338
331
  const parensConverter = {
339
- kind: [typescript_1.default.SyntaxKind.ParenthesizedType],
332
+ kind: [ts.SyntaxKind.ParenthesizedType],
340
333
  convert(context, node) {
341
334
  return convertType(context, node.type);
342
335
  },
@@ -344,14 +337,14 @@ const parensConverter = {
344
337
  convertType: requestBugReport,
345
338
  };
346
339
  const predicateConverter = {
347
- kind: [typescript_1.default.SyntaxKind.TypePredicate],
340
+ kind: [ts.SyntaxKind.TypePredicate],
348
341
  convert(context, node) {
349
- const name = typescript_1.default.isThisTypeNode(node.parameterName)
342
+ const name = ts.isThisTypeNode(node.parameterName)
350
343
  ? "this"
351
344
  : node.parameterName.getText();
352
345
  const asserts = !!node.assertsModifier;
353
346
  const targetType = node.type ? convertType(context, node.type) : void 0;
354
- return new models_1.PredicateType(name, asserts, targetType);
347
+ return new PredicateType(name, asserts, targetType);
355
348
  },
356
349
  // Never inferred by TS 4.0, could potentially change in a future TS version.
357
350
  convertType: requestBugReport,
@@ -359,85 +352,98 @@ const predicateConverter = {
359
352
  // This is a horrible thing... we're going to want to split this into converters
360
353
  // for different types at some point.
361
354
  const typeLiteralConverter = {
362
- kind: [typescript_1.default.SyntaxKind.TypeLiteral],
355
+ kind: [ts.SyntaxKind.TypeLiteral],
363
356
  convert(context, node) {
364
357
  const symbol = context.getSymbolAtLocation(node) ?? node.symbol;
365
358
  const type = context.getTypeAtLocation(node);
366
359
  if (!symbol || !type) {
367
- return new models_1.IntrinsicType("Object");
360
+ return new IntrinsicType("Object");
368
361
  }
369
- const reflection = new models_1.DeclarationReflection("__type", models_1.ReflectionKind.TypeLiteral, context.scope);
362
+ const reflection = new DeclarationReflection("__type", ReflectionKind.TypeLiteral, context.scope);
370
363
  const rc = context.withScope(reflection);
371
364
  rc.convertingTypeNode = true;
372
365
  context.registerReflection(reflection, symbol);
373
- context.converter.trigger(converter_events_1.ConverterEvents.CREATE_DECLARATION, context, reflection);
366
+ context.converter.trigger(ConverterEvents.CREATE_DECLARATION, context, reflection);
374
367
  for (const prop of context.checker.getPropertiesOfType(type)) {
375
- (0, symbols_1.convertSymbol)(rc, prop);
368
+ convertSymbol(rc, prop);
376
369
  }
377
370
  for (const signature of type.getCallSignatures()) {
378
- (0, signature_1.createSignature)(rc, models_1.ReflectionKind.CallSignature, signature, symbol);
371
+ createSignature(rc, ReflectionKind.CallSignature, signature, symbol);
379
372
  }
380
373
  for (const signature of type.getConstructSignatures()) {
381
- (0, signature_1.createSignature)(rc, models_1.ReflectionKind.ConstructorSignature, signature, symbol);
374
+ createSignature(rc, ReflectionKind.ConstructorSignature, signature, symbol);
382
375
  }
383
- (0, index_signature_1.convertIndexSignatures)(rc, symbol);
384
- return new models_1.ReflectionType(reflection);
376
+ convertIndexSignatures(rc, type);
377
+ return new ReflectionType(reflection);
385
378
  },
386
379
  convertType(context, type) {
387
380
  const symbol = type.getSymbol();
388
- const reflection = new models_1.DeclarationReflection("__type", models_1.ReflectionKind.TypeLiteral, context.scope);
381
+ const reflection = new DeclarationReflection("__type", ReflectionKind.TypeLiteral, context.scope);
389
382
  context.registerReflection(reflection, symbol);
390
- context.converter.trigger(converter_events_1.ConverterEvents.CREATE_DECLARATION, context, reflection);
383
+ context.converter.trigger(ConverterEvents.CREATE_DECLARATION, context, reflection);
391
384
  for (const prop of context.checker.getPropertiesOfType(type)) {
392
- (0, symbols_1.convertSymbol)(context.withScope(reflection), prop);
385
+ convertSymbol(context.withScope(reflection), prop);
393
386
  }
394
387
  for (const signature of type.getCallSignatures()) {
395
- (0, signature_1.createSignature)(context.withScope(reflection), models_1.ReflectionKind.CallSignature, signature, symbol);
388
+ createSignature(context.withScope(reflection), ReflectionKind.CallSignature, signature, symbol);
396
389
  }
397
390
  for (const signature of type.getConstructSignatures()) {
398
- (0, signature_1.createSignature)(context.withScope(reflection), models_1.ReflectionKind.ConstructorSignature, signature, symbol);
391
+ createSignature(context.withScope(reflection), ReflectionKind.ConstructorSignature, signature, symbol);
399
392
  }
400
393
  if (symbol) {
401
- (0, index_signature_1.convertIndexSignatures)(context.withScope(reflection), symbol);
394
+ convertIndexSignatures(context.withScope(reflection), type);
402
395
  }
403
- return new models_1.ReflectionType(reflection);
396
+ return new ReflectionType(reflection);
404
397
  },
405
398
  };
406
399
  const queryConverter = {
407
- kind: [typescript_1.default.SyntaxKind.TypeQuery],
400
+ kind: [ts.SyntaxKind.TypeQuery],
408
401
  convert(context, node) {
409
402
  const querySymbol = context.getSymbolAtLocation(node.exprName);
410
403
  if (!querySymbol) {
411
404
  // This can happen if someone uses `typeof` on some property
412
405
  // on a variable typed as `any` with a name that doesn't exist.
413
- return new models_1.QueryType(models_1.ReferenceType.createBrokenReference(node.exprName.getText(), context.project));
406
+ return new QueryType(ReferenceType.createBrokenReference(node.exprName.getText(), context.project));
414
407
  }
415
- const ref = models_1.ReferenceType.createSymbolReference(context.resolveAliasedSymbol(querySymbol), context, node.exprName.getText());
408
+ const ref = ReferenceType.createSymbolReference(context.resolveAliasedSymbol(querySymbol), context, node.exprName.getText());
416
409
  ref.preferValues = true;
417
- return new models_1.QueryType(ref);
410
+ return new QueryType(ref);
418
411
  },
419
412
  convertType(context, type, node) {
420
413
  // Order matters here - check the node location first so that if the typeof is targeting
421
414
  // an instantiation expression we get the user's exprName.
422
415
  const symbol = context.getSymbolAtLocation(node.exprName) || type.getSymbol();
423
- (0, assert_1.default)(symbol, `Query type failed to get a symbol for: ${context.checker.typeToString(type)}. This is a bug.`);
424
- const ref = models_1.ReferenceType.createSymbolReference(context.resolveAliasedSymbol(symbol), context);
416
+ assert(symbol, `Query type failed to get a symbol for: ${context.checker.typeToString(type)}. This is a bug.`);
417
+ const ref = ReferenceType.createSymbolReference(context.resolveAliasedSymbol(symbol), context);
425
418
  ref.preferValues = true;
426
- return new models_1.QueryType(ref);
419
+ return new QueryType(ref);
427
420
  },
428
421
  };
429
422
  const referenceConverter = {
430
- kind: [typescript_1.default.SyntaxKind.TypeReference],
423
+ kind: [ts.SyntaxKind.TypeReference],
431
424
  convert(context, node) {
432
- const isArray = context.checker.typeToTypeNode(context.checker.getTypeAtLocation(node.typeName), void 0, typescript_1.default.NodeBuilderFlags.IgnoreErrors)?.kind === typescript_1.default.SyntaxKind.ArrayType;
425
+ const type = context.checker.getTypeAtLocation(node.typeName);
426
+ const isArray = context.checker.typeToTypeNode(type, void 0, ts.NodeBuilderFlags.IgnoreErrors)?.kind === ts.SyntaxKind.ArrayType;
433
427
  if (isArray) {
434
- return new models_1.ArrayType(convertType(context, node.typeArguments?.[0]));
428
+ return new ArrayType(convertType(context, node.typeArguments?.[0]));
435
429
  }
436
430
  const symbol = context.expectSymbolAtLocation(node.typeName);
431
+ // Ignore @inline if there are type arguments, as they won't be resolved
432
+ // in the type we just retrieved from node.typeName.
433
+ if (!node.typeArguments &&
434
+ context
435
+ .getComment(symbol, ReflectionKind.Interface)
436
+ ?.hasModifier("@inline")) {
437
+ // typeLiteralConverter doesn't use the node, so we can get away with lying here.
438
+ // This might not actually be safe, it appears that it is in the relatively small
439
+ // amount of testing I've done with it, but I wouldn't be surprised if someone manages
440
+ // to find a crash.
441
+ return typeLiteralConverter.convertType(context, type, null);
442
+ }
437
443
  const name = node.typeName.getText();
438
- const type = models_1.ReferenceType.createSymbolReference(context.resolveAliasedSymbol(symbol), context, name);
439
- type.typeArguments = node.typeArguments?.map((type) => convertType(context, type));
440
- return type;
444
+ const ref = ReferenceType.createSymbolReference(context.resolveAliasedSymbol(symbol), context, name);
445
+ ref.typeArguments = node.typeArguments?.map((type) => convertType(context, type));
446
+ return ref;
441
447
  },
442
448
  convertType(context, type, node) {
443
449
  // typeName.symbol handles the case where this is a union which happens to refer
@@ -447,25 +453,34 @@ const referenceConverter = {
447
453
  if (!symbol) {
448
454
  // This happens when we get a reference to a type parameter
449
455
  // created within a mapped type, `K` in: `{ [K in T]: string }`
450
- const ref = models_1.ReferenceType.createBrokenReference(context.checker.typeToString(type), context.project);
456
+ const ref = ReferenceType.createBrokenReference(context.checker.typeToString(type), context.project);
451
457
  ref.refersToTypeParameter = true;
452
458
  return ref;
453
459
  }
460
+ if (context
461
+ .getComment(symbol, ReflectionKind.Interface)
462
+ ?.hasModifier("@inline")) {
463
+ // typeLiteralConverter doesn't use the node, so we can get away with lying here.
464
+ // This might not actually be safe, it appears that it is in the relatively small
465
+ // amount of testing I've done with it, but I wouldn't be surprised if someone manages
466
+ // to find a crash.
467
+ return typeLiteralConverter.convertType(context, type, null);
468
+ }
454
469
  let name;
455
- if (typescript_1.default.isIdentifier(node.typeName)) {
470
+ if (ts.isIdentifier(node.typeName)) {
456
471
  name = node.typeName.text;
457
472
  }
458
473
  else {
459
474
  name = node.typeName.right.text;
460
475
  }
461
- const ref = models_1.ReferenceType.createSymbolReference(context.resolveAliasedSymbol(symbol), context, name);
462
- if (type.flags & typescript_1.default.TypeFlags.Substitution) {
476
+ const ref = ReferenceType.createSymbolReference(context.resolveAliasedSymbol(symbol), context, name);
477
+ if (type.flags & ts.TypeFlags.Substitution) {
463
478
  // NoInfer<T>
464
479
  ref.typeArguments = [
465
480
  convertType(context, type.baseType),
466
481
  ];
467
482
  }
468
- else if (type.flags & typescript_1.default.TypeFlags.StringMapping) {
483
+ else if (type.flags & ts.TypeFlags.StringMapping) {
469
484
  ref.typeArguments = [
470
485
  convertType(context, type.type),
471
486
  ];
@@ -479,18 +494,18 @@ const referenceConverter = {
479
494
  },
480
495
  };
481
496
  const restConverter = {
482
- kind: [typescript_1.default.SyntaxKind.RestType],
497
+ kind: [ts.SyntaxKind.RestType],
483
498
  convert(context, node) {
484
- return new models_1.RestType(convertType(context, node.type));
499
+ return new RestType(convertType(context, node.type));
485
500
  },
486
501
  // This is handled in the tuple converter
487
502
  convertType: requestBugReport,
488
503
  };
489
504
  const namedTupleMemberConverter = {
490
- kind: [typescript_1.default.SyntaxKind.NamedTupleMember],
505
+ kind: [ts.SyntaxKind.NamedTupleMember],
491
506
  convert(context, node) {
492
507
  const innerType = convertType(context, node.type);
493
- return new models_1.NamedTupleMember(node.name.getText(), !!node.questionToken, innerType);
508
+ return new NamedTupleMember(node.name.getText(), !!node.questionToken, innerType);
494
509
  },
495
510
  // This ought to be impossible.
496
511
  convertType: requestBugReport,
@@ -502,103 +517,103 @@ const namedTupleMemberConverter = {
502
517
  // ^ questionToken
503
518
  // ^^^^^^ type
504
519
  const mappedConverter = {
505
- kind: [typescript_1.default.SyntaxKind.MappedType],
520
+ kind: [ts.SyntaxKind.MappedType],
506
521
  convert(context, node) {
507
522
  const optionalModifier = kindToModifier(node.questionToken?.kind);
508
523
  const templateType = convertType(context, node.type);
509
- return new models_1.MappedType(node.typeParameter.name.text, convertType(context, node.typeParameter.constraint), optionalModifier === "+"
510
- ? (0, reflections_1.removeUndefined)(templateType)
524
+ return new MappedType(node.typeParameter.name.text, convertType(context, node.typeParameter.constraint), optionalModifier === "+"
525
+ ? removeUndefined(templateType)
511
526
  : templateType, kindToModifier(node.readonlyToken?.kind), optionalModifier, node.nameType ? convertType(context, node.nameType) : void 0);
512
527
  },
513
528
  convertType(context, type, node) {
514
529
  // This can happen if a generic function does not have a return type annotated.
515
530
  const optionalModifier = kindToModifier(node.questionToken?.kind);
516
531
  const templateType = convertType(context, type.templateType);
517
- return new models_1.MappedType(type.typeParameter.symbol.name || "__type", convertType(context, type.typeParameter.getConstraint()), optionalModifier === "+"
518
- ? (0, reflections_1.removeUndefined)(templateType)
532
+ return new MappedType(type.typeParameter.symbol.name || "__type", convertType(context, type.typeParameter.getConstraint()), optionalModifier === "+"
533
+ ? removeUndefined(templateType)
519
534
  : templateType, kindToModifier(node.readonlyToken?.kind), optionalModifier, type.nameType ? convertType(context, type.nameType) : void 0);
520
535
  },
521
536
  };
522
537
  const literalTypeConverter = {
523
- kind: [typescript_1.default.SyntaxKind.LiteralType],
538
+ kind: [ts.SyntaxKind.LiteralType],
524
539
  convert(context, node) {
525
540
  switch (node.literal.kind) {
526
- case typescript_1.default.SyntaxKind.TrueKeyword:
527
- case typescript_1.default.SyntaxKind.FalseKeyword:
528
- return new models_1.LiteralType(node.literal.kind === typescript_1.default.SyntaxKind.TrueKeyword);
529
- case typescript_1.default.SyntaxKind.StringLiteral:
530
- return new models_1.LiteralType(node.literal.text);
531
- case typescript_1.default.SyntaxKind.NumericLiteral:
532
- return new models_1.LiteralType(Number(node.literal.text));
533
- case typescript_1.default.SyntaxKind.NullKeyword:
534
- return new models_1.LiteralType(null);
535
- case typescript_1.default.SyntaxKind.PrefixUnaryExpression: {
541
+ case ts.SyntaxKind.TrueKeyword:
542
+ case ts.SyntaxKind.FalseKeyword:
543
+ return new LiteralType(node.literal.kind === ts.SyntaxKind.TrueKeyword);
544
+ case ts.SyntaxKind.StringLiteral:
545
+ return new LiteralType(node.literal.text);
546
+ case ts.SyntaxKind.NumericLiteral:
547
+ return new LiteralType(Number(node.literal.text));
548
+ case ts.SyntaxKind.NullKeyword:
549
+ return new LiteralType(null);
550
+ case ts.SyntaxKind.PrefixUnaryExpression: {
536
551
  const operand = node.literal
537
552
  .operand;
538
553
  switch (operand.kind) {
539
- case typescript_1.default.SyntaxKind.NumericLiteral:
540
- return new models_1.LiteralType(Number(node.literal.getText()));
541
- case typescript_1.default.SyntaxKind.BigIntLiteral:
542
- return new models_1.LiteralType(BigInt(node.literal.getText().replace("n", "")));
554
+ case ts.SyntaxKind.NumericLiteral:
555
+ return new LiteralType(Number(node.literal.getText()));
556
+ case ts.SyntaxKind.BigIntLiteral:
557
+ return new LiteralType(BigInt(node.literal.getText().replace("n", "")));
543
558
  default:
544
559
  return requestBugReport(context, node.literal);
545
560
  }
546
561
  }
547
- case typescript_1.default.SyntaxKind.BigIntLiteral:
548
- return new models_1.LiteralType(BigInt(node.literal.getText().replace("n", "")));
549
- case typescript_1.default.SyntaxKind.NoSubstitutionTemplateLiteral:
550
- return new models_1.LiteralType(node.literal.text);
562
+ case ts.SyntaxKind.BigIntLiteral:
563
+ return new LiteralType(BigInt(node.literal.getText().replace("n", "")));
564
+ case ts.SyntaxKind.NoSubstitutionTemplateLiteral:
565
+ return new LiteralType(node.literal.text);
551
566
  }
552
567
  return requestBugReport(context, node.literal);
553
568
  },
554
569
  convertType(_context, type, node) {
555
570
  switch (node.literal.kind) {
556
- case typescript_1.default.SyntaxKind.StringLiteral:
557
- return new models_1.LiteralType(node.literal.text);
558
- case typescript_1.default.SyntaxKind.NumericLiteral:
559
- return new models_1.LiteralType(+node.literal.text);
560
- case typescript_1.default.SyntaxKind.TrueKeyword:
561
- case typescript_1.default.SyntaxKind.FalseKeyword:
562
- return new models_1.LiteralType(node.literal.kind === typescript_1.default.SyntaxKind.TrueKeyword);
563
- case typescript_1.default.SyntaxKind.NullKeyword:
564
- return new models_1.LiteralType(null);
571
+ case ts.SyntaxKind.StringLiteral:
572
+ return new LiteralType(node.literal.text);
573
+ case ts.SyntaxKind.NumericLiteral:
574
+ return new LiteralType(+node.literal.text);
575
+ case ts.SyntaxKind.TrueKeyword:
576
+ case ts.SyntaxKind.FalseKeyword:
577
+ return new LiteralType(node.literal.kind === ts.SyntaxKind.TrueKeyword);
578
+ case ts.SyntaxKind.NullKeyword:
579
+ return new LiteralType(null);
565
580
  }
566
581
  if (typeof type.value === "object") {
567
- return new models_1.LiteralType(BigInt(`${type.value.negative ? "-" : ""}${type.value.base10Value}`));
582
+ return new LiteralType(BigInt(`${type.value.negative ? "-" : ""}${type.value.base10Value}`));
568
583
  }
569
- return new models_1.LiteralType(type.value);
584
+ return new LiteralType(type.value);
570
585
  },
571
586
  };
572
587
  const templateLiteralConverter = {
573
- kind: [typescript_1.default.SyntaxKind.TemplateLiteralType],
588
+ kind: [ts.SyntaxKind.TemplateLiteralType],
574
589
  convert(context, node) {
575
- return new models_1.TemplateLiteralType(node.head.text, node.templateSpans.map((span) => {
590
+ return new TemplateLiteralType(node.head.text, node.templateSpans.map((span) => {
576
591
  return [convertType(context, span.type), span.literal.text];
577
592
  }));
578
593
  },
579
594
  convertType(context, type) {
580
- (0, assert_1.default)(type.texts.length === type.types.length + 1);
595
+ assert(type.texts.length === type.types.length + 1);
581
596
  const parts = [];
582
- for (const [a, b] of (0, array_1.zip)(type.types, type.texts.slice(1))) {
597
+ for (const [a, b] of zip(type.types, type.texts.slice(1))) {
583
598
  parts.push([convertType(context, a), b]);
584
599
  }
585
- return new models_1.TemplateLiteralType(type.texts[0], parts);
600
+ return new TemplateLiteralType(type.texts[0], parts);
586
601
  },
587
602
  };
588
603
  const thisConverter = {
589
- kind: [typescript_1.default.SyntaxKind.ThisType],
604
+ kind: [ts.SyntaxKind.ThisType],
590
605
  convert() {
591
- return new models_1.IntrinsicType("this");
606
+ return new IntrinsicType("this");
592
607
  },
593
608
  convertType() {
594
- return new models_1.IntrinsicType("this");
609
+ return new IntrinsicType("this");
595
610
  },
596
611
  };
597
612
  const tupleConverter = {
598
- kind: [typescript_1.default.SyntaxKind.TupleType],
613
+ kind: [ts.SyntaxKind.TupleType],
599
614
  convert(context, node) {
600
615
  const elements = node.elements.map((node) => convertType(context, node));
601
- return new models_1.TupleType(elements);
616
+ return new TupleType(elements);
602
617
  },
603
618
  convertType(context, type, node) {
604
619
  const types = type.typeArguments?.slice(0, node.elements.length);
@@ -608,56 +623,56 @@ const tupleConverter = {
608
623
  elements = elements?.map((el, i) => {
609
624
  const namedDecl = namedDeclarations[i];
610
625
  return namedDecl
611
- ? new models_1.NamedTupleMember(namedDecl.name.getText(), !!namedDecl.questionToken, (0, reflections_1.removeUndefined)(el))
626
+ ? new NamedTupleMember(namedDecl.name.getText(), !!namedDecl.questionToken, removeUndefined(el))
612
627
  : el;
613
628
  });
614
629
  }
615
630
  elements = elements?.map((el, i) => {
616
- if (type.target.elementFlags[i] & typescript_1.default.ElementFlags.Variable) {
631
+ if (type.target.elementFlags[i] & ts.ElementFlags.Variable) {
617
632
  // In the node case, we don't need to add the wrapping Array type... but we do here.
618
- if (el instanceof models_1.NamedTupleMember) {
619
- return new models_1.RestType(new models_1.NamedTupleMember(el.name, el.isOptional, new models_1.ArrayType(el.element)));
633
+ if (el instanceof NamedTupleMember) {
634
+ return new RestType(new NamedTupleMember(el.name, el.isOptional, new ArrayType(el.element)));
620
635
  }
621
- return new models_1.RestType(new models_1.ArrayType(el));
636
+ return new RestType(new ArrayType(el));
622
637
  }
623
- if (type.target.elementFlags[i] & typescript_1.default.ElementFlags.Optional &&
624
- !(el instanceof models_1.NamedTupleMember)) {
625
- return new models_1.OptionalType((0, reflections_1.removeUndefined)(el));
638
+ if (type.target.elementFlags[i] & ts.ElementFlags.Optional &&
639
+ !(el instanceof NamedTupleMember)) {
640
+ return new OptionalType(removeUndefined(el));
626
641
  }
627
642
  return el;
628
643
  });
629
- return new models_1.TupleType(elements ?? []);
644
+ return new TupleType(elements ?? []);
630
645
  },
631
646
  };
632
647
  const supportedOperatorNames = {
633
- [typescript_1.default.SyntaxKind.KeyOfKeyword]: "keyof",
634
- [typescript_1.default.SyntaxKind.UniqueKeyword]: "unique",
635
- [typescript_1.default.SyntaxKind.ReadonlyKeyword]: "readonly",
648
+ [ts.SyntaxKind.KeyOfKeyword]: "keyof",
649
+ [ts.SyntaxKind.UniqueKeyword]: "unique",
650
+ [ts.SyntaxKind.ReadonlyKeyword]: "readonly",
636
651
  };
637
652
  const typeOperatorConverter = {
638
- kind: [typescript_1.default.SyntaxKind.TypeOperator],
653
+ kind: [ts.SyntaxKind.TypeOperator],
639
654
  convert(context, node) {
640
- return new models_1.TypeOperatorType(convertType(context, node.type), supportedOperatorNames[node.operator]);
655
+ return new TypeOperatorType(convertType(context, node.type), supportedOperatorNames[node.operator]);
641
656
  },
642
657
  convertType(context, type, node) {
643
658
  // readonly is only valid on array and tuple literal types.
644
- if (node.operator === typescript_1.default.SyntaxKind.ReadonlyKeyword) {
659
+ if (node.operator === ts.SyntaxKind.ReadonlyKeyword) {
645
660
  const resolved = resolveReference(type);
646
- (0, assert_1.default)((0, nodes_1.isObjectType)(resolved));
661
+ assert(isObjectType(resolved));
647
662
  const args = context.checker
648
663
  .getTypeArguments(type)
649
664
  .map((type) => convertType(context, type));
650
- const inner = resolved.objectFlags & typescript_1.default.ObjectFlags.Tuple
651
- ? new models_1.TupleType(args)
652
- : new models_1.ArrayType(args[0]);
653
- return new models_1.TypeOperatorType(inner, "readonly");
665
+ const inner = resolved.objectFlags & ts.ObjectFlags.Tuple
666
+ ? new TupleType(args)
667
+ : new ArrayType(args[0]);
668
+ return new TypeOperatorType(inner, "readonly");
654
669
  }
655
670
  // keyof will only show up with generic functions, otherwise it gets eagerly
656
671
  // resolved to a union of strings.
657
- if (node.operator === typescript_1.default.SyntaxKind.KeyOfKeyword) {
672
+ if (node.operator === ts.SyntaxKind.KeyOfKeyword) {
658
673
  // There's probably an interface for this somewhere... I couldn't find it.
659
674
  const targetType = type.type;
660
- return new models_1.TypeOperatorType(convertType(context, targetType), "keyof");
675
+ return new TypeOperatorType(convertType(context, targetType), "keyof");
661
676
  }
662
677
  // TS drops `unique` in `unique symbol` everywhere. If someone used it, we ought
663
678
  // to have a type node. This shouldn't ever happen.
@@ -665,30 +680,30 @@ const typeOperatorConverter = {
665
680
  },
666
681
  };
667
682
  const unionConverter = {
668
- kind: [typescript_1.default.SyntaxKind.UnionType],
683
+ kind: [ts.SyntaxKind.UnionType],
669
684
  convert(context, node) {
670
- return new models_1.UnionType(node.types.map((type) => convertType(context, type)));
685
+ return new UnionType(node.types.map((type) => convertType(context, type)));
671
686
  },
672
687
  convertType(context, type) {
673
688
  const types = type.types.map((type) => convertType(context, type));
674
689
  normalizeUnion(types);
675
690
  sortLiteralUnion(types);
676
- return new models_1.UnionType(types);
691
+ return new UnionType(types);
677
692
  },
678
693
  };
679
694
  const jsDocNullableTypeConverter = {
680
- kind: [typescript_1.default.SyntaxKind.JSDocNullableType],
695
+ kind: [ts.SyntaxKind.JSDocNullableType],
681
696
  convert(context, node) {
682
- return new models_1.UnionType([
697
+ return new UnionType([
683
698
  convertType(context, node.type),
684
- new models_1.LiteralType(null),
699
+ new LiteralType(null),
685
700
  ]);
686
701
  },
687
702
  // Should be a UnionType
688
703
  convertType: requestBugReport,
689
704
  };
690
705
  const jsDocNonNullableTypeConverter = {
691
- kind: [typescript_1.default.SyntaxKind.JSDocNonNullableType],
706
+ kind: [ts.SyntaxKind.JSDocNonNullableType],
692
707
  convert(context, node) {
693
708
  return convertType(context, node.type);
694
709
  },
@@ -697,29 +712,29 @@ const jsDocNonNullableTypeConverter = {
697
712
  };
698
713
  function requestBugReport(context, nodeOrType) {
699
714
  if ("kind" in nodeOrType) {
700
- const kindName = typescript_1.default.SyntaxKind[nodeOrType.kind];
715
+ const kindName = ts.SyntaxKind[nodeOrType.kind];
701
716
  context.logger.warn(`Failed to convert type node with kind: ${kindName} and text ${nodeOrType.getText()}. Please report a bug.`, nodeOrType);
702
- return new models_1.UnknownType(nodeOrType.getText());
717
+ return new UnknownType(nodeOrType.getText());
703
718
  }
704
719
  else {
705
720
  const typeString = context.checker.typeToString(nodeOrType);
706
721
  context.logger.warn(`Failed to convert type: ${typeString} when converting ${context.scope.getFullName()}. Please report a bug.`);
707
- return new models_1.UnknownType(typeString);
722
+ return new UnknownType(typeString);
708
723
  }
709
724
  }
710
725
  function resolveReference(type) {
711
- if ((0, nodes_1.isObjectType)(type) && type.objectFlags & typescript_1.default.ObjectFlags.Reference) {
726
+ if (isObjectType(type) && type.objectFlags & ts.ObjectFlags.Reference) {
712
727
  return type.target;
713
728
  }
714
729
  return type;
715
730
  }
716
731
  function kindToModifier(kind) {
717
732
  switch (kind) {
718
- case typescript_1.default.SyntaxKind.ReadonlyKeyword:
719
- case typescript_1.default.SyntaxKind.QuestionToken:
720
- case typescript_1.default.SyntaxKind.PlusToken:
733
+ case ts.SyntaxKind.ReadonlyKeyword:
734
+ case ts.SyntaxKind.QuestionToken:
735
+ case ts.SyntaxKind.PlusToken:
721
736
  return "+";
722
- case typescript_1.default.SyntaxKind.MinusToken:
737
+ case ts.SyntaxKind.MinusToken:
723
738
  return "-";
724
739
  default:
725
740
  return undefined;
@@ -740,7 +755,7 @@ function normalizeUnion(types) {
740
755
  let falseIndex = -1;
741
756
  for (let i = 0; i < types.length && (trueIndex === -1 || falseIndex === -1); i++) {
742
757
  const t = types[i];
743
- if (t instanceof models_1.LiteralType) {
758
+ if (t instanceof LiteralType) {
744
759
  if (t.value === true) {
745
760
  trueIndex = i;
746
761
  }
@@ -751,6 +766,6 @@ function normalizeUnion(types) {
751
766
  }
752
767
  if (trueIndex !== -1 && falseIndex !== -1) {
753
768
  types.splice(Math.max(trueIndex, falseIndex), 1);
754
- types.splice(Math.min(trueIndex, falseIndex), 1, new models_1.IntrinsicType("boolean"));
769
+ types.splice(Math.min(trueIndex, falseIndex), 1, new IntrinsicType("boolean"));
755
770
  }
756
771
  }