typescript-native-bridge 0.0.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 (488) hide show
  1. package/LICENSE +55 -0
  2. package/NOTICE +18 -0
  3. package/README.md +448 -0
  4. package/bin/tsc +2 -0
  5. package/bin/tsserver +2 -0
  6. package/lib/.gitattributes +1 -0
  7. package/lib/_tsc.js +136979 -0
  8. package/lib/_tsserver.js +659 -0
  9. package/lib/_typingsInstaller.js +222 -0
  10. package/lib/cs/diagnosticMessages.generated.json +2129 -0
  11. package/lib/de/diagnosticMessages.generated.json +2125 -0
  12. package/lib/es/diagnosticMessages.generated.json +2129 -0
  13. package/lib/fr/diagnosticMessages.generated.json +2129 -0
  14. package/lib/it/diagnosticMessages.generated.json +2125 -0
  15. package/lib/ja/diagnosticMessages.generated.json +2129 -0
  16. package/lib/ko/diagnosticMessages.generated.json +2129 -0
  17. package/lib/lib.d.ts +20 -0
  18. package/lib/lib.decorators.d.ts +382 -0
  19. package/lib/lib.decorators.legacy.d.ts +20 -0
  20. package/lib/lib.dom.asynciterable.d.ts +18 -0
  21. package/lib/lib.dom.d.ts +45125 -0
  22. package/lib/lib.dom.iterable.d.ts +18 -0
  23. package/lib/lib.es2015.collection.d.ts +159 -0
  24. package/lib/lib.es2015.core.d.ts +595 -0
  25. package/lib/lib.es2015.d.ts +26 -0
  26. package/lib/lib.es2015.generator.d.ts +75 -0
  27. package/lib/lib.es2015.iterable.d.ts +603 -0
  28. package/lib/lib.es2015.promise.d.ts +79 -0
  29. package/lib/lib.es2015.proxy.d.ts +126 -0
  30. package/lib/lib.es2015.reflect.d.ts +142 -0
  31. package/lib/lib.es2015.symbol.d.ts +44 -0
  32. package/lib/lib.es2015.symbol.wellknown.d.ts +324 -0
  33. package/lib/lib.es2016.array.include.d.ts +114 -0
  34. package/lib/lib.es2016.d.ts +19 -0
  35. package/lib/lib.es2016.full.d.ts +21 -0
  36. package/lib/lib.es2016.intl.d.ts +29 -0
  37. package/lib/lib.es2017.arraybuffer.d.ts +19 -0
  38. package/lib/lib.es2017.d.ts +24 -0
  39. package/lib/lib.es2017.date.d.ts +29 -0
  40. package/lib/lib.es2017.full.d.ts +21 -0
  41. package/lib/lib.es2017.intl.d.ts +42 -0
  42. package/lib/lib.es2017.object.d.ts +47 -0
  43. package/lib/lib.es2017.sharedmemory.d.ts +133 -0
  44. package/lib/lib.es2017.string.d.ts +47 -0
  45. package/lib/lib.es2017.typedarrays.d.ts +51 -0
  46. package/lib/lib.es2018.asyncgenerator.d.ts +75 -0
  47. package/lib/lib.es2018.asynciterable.d.ts +51 -0
  48. package/lib/lib.es2018.d.ts +22 -0
  49. package/lib/lib.es2018.full.d.ts +22 -0
  50. package/lib/lib.es2018.intl.d.ts +81 -0
  51. package/lib/lib.es2018.promise.d.ts +28 -0
  52. package/lib/lib.es2018.regexp.d.ts +35 -0
  53. package/lib/lib.es2019.array.d.ts +77 -0
  54. package/lib/lib.es2019.d.ts +22 -0
  55. package/lib/lib.es2019.full.d.ts +22 -0
  56. package/lib/lib.es2019.intl.d.ts +21 -0
  57. package/lib/lib.es2019.object.d.ts +31 -0
  58. package/lib/lib.es2019.string.d.ts +35 -0
  59. package/lib/lib.es2019.symbol.d.ts +22 -0
  60. package/lib/lib.es2020.bigint.d.ts +763 -0
  61. package/lib/lib.es2020.d.ts +25 -0
  62. package/lib/lib.es2020.date.d.ts +40 -0
  63. package/lib/lib.es2020.full.d.ts +22 -0
  64. package/lib/lib.es2020.intl.d.ts +472 -0
  65. package/lib/lib.es2020.number.d.ts +26 -0
  66. package/lib/lib.es2020.promise.d.ts +45 -0
  67. package/lib/lib.es2020.sharedmemory.d.ts +97 -0
  68. package/lib/lib.es2020.string.d.ts +42 -0
  69. package/lib/lib.es2020.symbol.wellknown.d.ts +39 -0
  70. package/lib/lib.es2021.d.ts +21 -0
  71. package/lib/lib.es2021.full.d.ts +22 -0
  72. package/lib/lib.es2021.intl.d.ts +164 -0
  73. package/lib/lib.es2021.promise.d.ts +46 -0
  74. package/lib/lib.es2021.string.d.ts +31 -0
  75. package/lib/lib.es2021.weakref.d.ts +76 -0
  76. package/lib/lib.es2022.array.d.ts +119 -0
  77. package/lib/lib.es2022.d.ts +23 -0
  78. package/lib/lib.es2022.error.d.ts +73 -0
  79. package/lib/lib.es2022.full.d.ts +22 -0
  80. package/lib/lib.es2022.intl.d.ts +143 -0
  81. package/lib/lib.es2022.object.d.ts +24 -0
  82. package/lib/lib.es2022.regexp.d.ts +37 -0
  83. package/lib/lib.es2022.string.d.ts +23 -0
  84. package/lib/lib.es2023.array.d.ts +922 -0
  85. package/lib/lib.es2023.collection.d.ts +19 -0
  86. package/lib/lib.es2023.d.ts +20 -0
  87. package/lib/lib.es2023.full.d.ts +22 -0
  88. package/lib/lib.es2023.intl.d.ts +62 -0
  89. package/lib/lib.es2024.arraybuffer.d.ts +63 -0
  90. package/lib/lib.es2024.collection.d.ts +27 -0
  91. package/lib/lib.es2024.d.ts +24 -0
  92. package/lib/lib.es2024.full.d.ts +22 -0
  93. package/lib/lib.es2024.object.d.ts +27 -0
  94. package/lib/lib.es2024.promise.d.ts +33 -0
  95. package/lib/lib.es2024.regexp.d.ts +23 -0
  96. package/lib/lib.es2024.sharedmemory.d.ts +66 -0
  97. package/lib/lib.es2024.string.d.ts +27 -0
  98. package/lib/lib.es2025.collection.d.ts +94 -0
  99. package/lib/lib.es2025.d.ts +23 -0
  100. package/lib/lib.es2025.float16.d.ts +443 -0
  101. package/lib/lib.es2025.full.d.ts +22 -0
  102. package/lib/lib.es2025.intl.d.ts +200 -0
  103. package/lib/lib.es2025.iterator.d.ts +146 -0
  104. package/lib/lib.es2025.promise.d.ts +32 -0
  105. package/lib/lib.es2025.regexp.d.ts +30 -0
  106. package/lib/lib.es5.d.ts +4599 -0
  107. package/lib/lib.es6.d.ts +21 -0
  108. package/lib/lib.esnext.array.d.ts +33 -0
  109. package/lib/lib.esnext.collection.d.ts +47 -0
  110. package/lib/lib.esnext.d.ts +27 -0
  111. package/lib/lib.esnext.date.d.ts +21 -0
  112. package/lib/lib.esnext.decorators.d.ts +26 -0
  113. package/lib/lib.esnext.disposable.d.ts +191 -0
  114. package/lib/lib.esnext.error.d.ts +22 -0
  115. package/lib/lib.esnext.full.d.ts +22 -0
  116. package/lib/lib.esnext.intl.d.ts +107 -0
  117. package/lib/lib.esnext.sharedmemory.d.ts +23 -0
  118. package/lib/lib.esnext.temporal.d.ts +485 -0
  119. package/lib/lib.esnext.typedarrays.d.ts +90 -0
  120. package/lib/lib.scripthost.d.ts +320 -0
  121. package/lib/lib.webworker.asynciterable.d.ts +18 -0
  122. package/lib/lib.webworker.d.ts +15606 -0
  123. package/lib/lib.webworker.importscripts.d.ts +21 -0
  124. package/lib/lib.webworker.iterable.d.ts +18 -0
  125. package/lib/pl/diagnosticMessages.generated.json +2129 -0
  126. package/lib/pt-br/diagnosticMessages.generated.json +2129 -0
  127. package/lib/ru/diagnosticMessages.generated.json +2125 -0
  128. package/lib/tr/diagnosticMessages.generated.json +2129 -0
  129. package/lib/tsc.js +8 -0
  130. package/lib/tsserver.js +8 -0
  131. package/lib/tsserverlibrary.d.ts +17 -0
  132. package/lib/tsserverlibrary.js +21 -0
  133. package/lib/typesMap.json +497 -0
  134. package/lib/typescript.d.ts +11454 -0
  135. package/lib/typescript.js +203598 -0
  136. package/lib/typingsInstaller.js +8 -0
  137. package/lib/watchGuard.js +53 -0
  138. package/lib/zh-cn/diagnosticMessages.generated.json +2129 -0
  139. package/lib/zh-tw/diagnosticMessages.generated.json +2125 -0
  140. package/native/bridge.dylib +0 -0
  141. package/native/bridge.h +103 -0
  142. package/package.json +35 -0
  143. package/vendor/native-preview/bin/tsgo +2 -0
  144. package/vendor/native-preview/dist/api/async/api.d.ts +408 -0
  145. package/vendor/native-preview/dist/api/async/api.d.ts.map +1 -0
  146. package/vendor/native-preview/dist/api/async/api.js +1467 -0
  147. package/vendor/native-preview/dist/api/async/api.js.map +1 -0
  148. package/vendor/native-preview/dist/api/async/client.d.ts +22 -0
  149. package/vendor/native-preview/dist/api/async/client.d.ts.map +1 -0
  150. package/vendor/native-preview/dist/api/async/client.js +140 -0
  151. package/vendor/native-preview/dist/api/async/client.js.map +1 -0
  152. package/vendor/native-preview/dist/api/async/types.d.ts +298 -0
  153. package/vendor/native-preview/dist/api/async/types.d.ts.map +1 -0
  154. package/vendor/native-preview/dist/api/async/types.js +2 -0
  155. package/vendor/native-preview/dist/api/async/types.js.map +1 -0
  156. package/vendor/native-preview/dist/api/fs.d.ts +23 -0
  157. package/vendor/native-preview/dist/api/fs.d.ts.map +1 -0
  158. package/vendor/native-preview/dist/api/fs.js +109 -0
  159. package/vendor/native-preview/dist/api/fs.js.map +1 -0
  160. package/vendor/native-preview/dist/api/node/encoder.d.ts +15 -0
  161. package/vendor/native-preview/dist/api/node/encoder.d.ts.map +1 -0
  162. package/vendor/native-preview/dist/api/node/encoder.generated.d.ts +5 -0
  163. package/vendor/native-preview/dist/api/node/encoder.generated.d.ts.map +1 -0
  164. package/vendor/native-preview/dist/api/node/encoder.generated.js +74 -0
  165. package/vendor/native-preview/dist/api/node/encoder.generated.js.map +1 -0
  166. package/vendor/native-preview/dist/api/node/encoder.js +304 -0
  167. package/vendor/native-preview/dist/api/node/encoder.js.map +1 -0
  168. package/vendor/native-preview/dist/api/node/msgpack.d.ts +32 -0
  169. package/vendor/native-preview/dist/api/node/msgpack.d.ts.map +1 -0
  170. package/vendor/native-preview/dist/api/node/msgpack.js +212 -0
  171. package/vendor/native-preview/dist/api/node/msgpack.js.map +1 -0
  172. package/vendor/native-preview/dist/api/node/node.d.ts +70 -0
  173. package/vendor/native-preview/dist/api/node/node.d.ts.map +1 -0
  174. package/vendor/native-preview/dist/api/node/node.generated.d.ts +182 -0
  175. package/vendor/native-preview/dist/api/node/node.generated.d.ts.map +1 -0
  176. package/vendor/native-preview/dist/api/node/node.generated.js +850 -0
  177. package/vendor/native-preview/dist/api/node/node.generated.js.map +1 -0
  178. package/vendor/native-preview/dist/api/node/node.infrastructure.d.ts +53 -0
  179. package/vendor/native-preview/dist/api/node/node.infrastructure.d.ts.map +1 -0
  180. package/vendor/native-preview/dist/api/node/node.infrastructure.js +126 -0
  181. package/vendor/native-preview/dist/api/node/node.infrastructure.js.map +1 -0
  182. package/vendor/native-preview/dist/api/node/node.js +252 -0
  183. package/vendor/native-preview/dist/api/node/node.js.map +1 -0
  184. package/vendor/native-preview/dist/api/node/protocol.d.ts +29 -0
  185. package/vendor/native-preview/dist/api/node/protocol.d.ts.map +1 -0
  186. package/vendor/native-preview/dist/api/node/protocol.generated.d.ts +4 -0
  187. package/vendor/native-preview/dist/api/node/protocol.generated.d.ts.map +1 -0
  188. package/vendor/native-preview/dist/api/node/protocol.generated.js +241 -0
  189. package/vendor/native-preview/dist/api/node/protocol.generated.js.map +1 -0
  190. package/vendor/native-preview/dist/api/node/protocol.js +30 -0
  191. package/vendor/native-preview/dist/api/node/protocol.js.map +1 -0
  192. package/vendor/native-preview/dist/api/options.d.ts +24 -0
  193. package/vendor/native-preview/dist/api/options.d.ts.map +1 -0
  194. package/vendor/native-preview/dist/api/options.js +11 -0
  195. package/vendor/native-preview/dist/api/options.js.map +1 -0
  196. package/vendor/native-preview/dist/api/path.d.ts +110 -0
  197. package/vendor/native-preview/dist/api/path.d.ts.map +1 -0
  198. package/vendor/native-preview/dist/api/path.js +508 -0
  199. package/vendor/native-preview/dist/api/path.js.map +1 -0
  200. package/vendor/native-preview/dist/api/proto.d.ts +236 -0
  201. package/vendor/native-preview/dist/api/proto.d.ts.map +1 -0
  202. package/vendor/native-preview/dist/api/proto.js +37 -0
  203. package/vendor/native-preview/dist/api/proto.js.map +1 -0
  204. package/vendor/native-preview/dist/api/sourceFileCache.d.ts +79 -0
  205. package/vendor/native-preview/dist/api/sourceFileCache.d.ts.map +1 -0
  206. package/vendor/native-preview/dist/api/sourceFileCache.js +169 -0
  207. package/vendor/native-preview/dist/api/sourceFileCache.js.map +1 -0
  208. package/vendor/native-preview/dist/api/sync/api.d.ts +436 -0
  209. package/vendor/native-preview/dist/api/sync/api.d.ts.map +1 -0
  210. package/vendor/native-preview/dist/api/sync/api.js +1573 -0
  211. package/vendor/native-preview/dist/api/sync/api.js.map +1 -0
  212. package/vendor/native-preview/dist/api/sync/client.d.ts +13 -0
  213. package/vendor/native-preview/dist/api/sync/client.d.ts.map +1 -0
  214. package/vendor/native-preview/dist/api/sync/client.js +72 -0
  215. package/vendor/native-preview/dist/api/sync/client.js.map +1 -0
  216. package/vendor/native-preview/dist/api/sync/types.d.ts +311 -0
  217. package/vendor/native-preview/dist/api/sync/types.d.ts.map +1 -0
  218. package/vendor/native-preview/dist/api/sync/types.js +2 -0
  219. package/vendor/native-preview/dist/api/sync/types.js.map +1 -0
  220. package/vendor/native-preview/dist/api/syncChannel.d.ts +111 -0
  221. package/vendor/native-preview/dist/api/syncChannel.d.ts.map +1 -0
  222. package/vendor/native-preview/dist/api/syncChannel.js +488 -0
  223. package/vendor/native-preview/dist/api/syncChannel.js.map +1 -0
  224. package/vendor/native-preview/dist/ast/ast.d.ts +76 -0
  225. package/vendor/native-preview/dist/ast/ast.d.ts.map +1 -0
  226. package/vendor/native-preview/dist/ast/ast.generated.d.ts +1161 -0
  227. package/vendor/native-preview/dist/ast/ast.generated.d.ts.map +1 -0
  228. package/vendor/native-preview/dist/ast/ast.generated.js +4 -0
  229. package/vendor/native-preview/dist/ast/ast.generated.js.map +1 -0
  230. package/vendor/native-preview/dist/ast/ast.js +7 -0
  231. package/vendor/native-preview/dist/ast/ast.js.map +1 -0
  232. package/vendor/native-preview/dist/ast/astnav.d.ts +19 -0
  233. package/vendor/native-preview/dist/ast/astnav.d.ts.map +1 -0
  234. package/vendor/native-preview/dist/ast/astnav.js +596 -0
  235. package/vendor/native-preview/dist/ast/astnav.js.map +1 -0
  236. package/vendor/native-preview/dist/ast/clone.d.ts +16 -0
  237. package/vendor/native-preview/dist/ast/clone.d.ts.map +1 -0
  238. package/vendor/native-preview/dist/ast/clone.js +104 -0
  239. package/vendor/native-preview/dist/ast/clone.js.map +1 -0
  240. package/vendor/native-preview/dist/ast/factory.generated.d.ts +522 -0
  241. package/vendor/native-preview/dist/ast/factory.generated.d.ts.map +1 -0
  242. package/vendor/native-preview/dist/ast/factory.generated.js +3059 -0
  243. package/vendor/native-preview/dist/ast/factory.generated.js.map +1 -0
  244. package/vendor/native-preview/dist/ast/index.d.ts +18 -0
  245. package/vendor/native-preview/dist/ast/index.d.ts.map +1 -0
  246. package/vendor/native-preview/dist/ast/index.js +18 -0
  247. package/vendor/native-preview/dist/ast/index.js.map +1 -0
  248. package/vendor/native-preview/dist/ast/is.d.ts +34 -0
  249. package/vendor/native-preview/dist/ast/is.d.ts.map +1 -0
  250. package/vendor/native-preview/dist/ast/is.generated.d.ts +330 -0
  251. package/vendor/native-preview/dist/ast/is.generated.d.ts.map +1 -0
  252. package/vendor/native-preview/dist/ast/is.generated.js +1107 -0
  253. package/vendor/native-preview/dist/ast/is.generated.js.map +1 -0
  254. package/vendor/native-preview/dist/ast/is.js +226 -0
  255. package/vendor/native-preview/dist/ast/is.js.map +1 -0
  256. package/vendor/native-preview/dist/ast/scanner.d.ts +97 -0
  257. package/vendor/native-preview/dist/ast/scanner.d.ts.map +1 -0
  258. package/vendor/native-preview/dist/ast/scanner.js +2230 -0
  259. package/vendor/native-preview/dist/ast/scanner.js.map +1 -0
  260. package/vendor/native-preview/dist/ast/utils.d.ts +7 -0
  261. package/vendor/native-preview/dist/ast/utils.d.ts.map +1 -0
  262. package/vendor/native-preview/dist/ast/utils.js +47 -0
  263. package/vendor/native-preview/dist/ast/utils.js.map +1 -0
  264. package/vendor/native-preview/dist/ast/visitor.d.ts +14 -0
  265. package/vendor/native-preview/dist/ast/visitor.d.ts.map +1 -0
  266. package/vendor/native-preview/dist/ast/visitor.generated.d.ts +50 -0
  267. package/vendor/native-preview/dist/ast/visitor.generated.d.ts.map +1 -0
  268. package/vendor/native-preview/dist/ast/visitor.generated.js +978 -0
  269. package/vendor/native-preview/dist/ast/visitor.generated.js.map +1 -0
  270. package/vendor/native-preview/dist/ast/visitor.js +47 -0
  271. package/vendor/native-preview/dist/ast/visitor.js.map +1 -0
  272. package/vendor/native-preview/dist/enums/characterCodes.d.ts +2 -0
  273. package/vendor/native-preview/dist/enums/characterCodes.d.ts.map +1 -0
  274. package/vendor/native-preview/dist/enums/characterCodes.enum.d.ts +129 -0
  275. package/vendor/native-preview/dist/enums/characterCodes.enum.d.ts.map +1 -0
  276. package/vendor/native-preview/dist/enums/characterCodes.enum.js +132 -0
  277. package/vendor/native-preview/dist/enums/characterCodes.enum.js.map +1 -0
  278. package/vendor/native-preview/dist/enums/characterCodes.js +130 -0
  279. package/vendor/native-preview/dist/enums/characterCodes.js.map +1 -0
  280. package/vendor/native-preview/dist/enums/commentDirectiveType.d.ts +2 -0
  281. package/vendor/native-preview/dist/enums/commentDirectiveType.d.ts.map +1 -0
  282. package/vendor/native-preview/dist/enums/commentDirectiveType.enum.d.ts +5 -0
  283. package/vendor/native-preview/dist/enums/commentDirectiveType.enum.d.ts.map +1 -0
  284. package/vendor/native-preview/dist/enums/commentDirectiveType.enum.js +6 -0
  285. package/vendor/native-preview/dist/enums/commentDirectiveType.enum.js.map +1 -0
  286. package/vendor/native-preview/dist/enums/commentDirectiveType.js +6 -0
  287. package/vendor/native-preview/dist/enums/commentDirectiveType.js.map +1 -0
  288. package/vendor/native-preview/dist/enums/completionItemKind.d.ts +2 -0
  289. package/vendor/native-preview/dist/enums/completionItemKind.d.ts.map +1 -0
  290. package/vendor/native-preview/dist/enums/completionItemKind.enum.d.ts +28 -0
  291. package/vendor/native-preview/dist/enums/completionItemKind.enum.d.ts.map +1 -0
  292. package/vendor/native-preview/dist/enums/completionItemKind.enum.js +30 -0
  293. package/vendor/native-preview/dist/enums/completionItemKind.enum.js.map +1 -0
  294. package/vendor/native-preview/dist/enums/completionItemKind.js +30 -0
  295. package/vendor/native-preview/dist/enums/completionItemKind.js.map +1 -0
  296. package/vendor/native-preview/dist/enums/diagnosticCategory.d.ts +2 -0
  297. package/vendor/native-preview/dist/enums/diagnosticCategory.d.ts.map +1 -0
  298. package/vendor/native-preview/dist/enums/diagnosticCategory.enum.d.ts +7 -0
  299. package/vendor/native-preview/dist/enums/diagnosticCategory.enum.d.ts.map +1 -0
  300. package/vendor/native-preview/dist/enums/diagnosticCategory.enum.js +9 -0
  301. package/vendor/native-preview/dist/enums/diagnosticCategory.enum.js.map +1 -0
  302. package/vendor/native-preview/dist/enums/diagnosticCategory.js +9 -0
  303. package/vendor/native-preview/dist/enums/diagnosticCategory.js.map +1 -0
  304. package/vendor/native-preview/dist/enums/elementFlags.d.ts +2 -0
  305. package/vendor/native-preview/dist/enums/elementFlags.d.ts.map +1 -0
  306. package/vendor/native-preview/dist/enums/elementFlags.enum.d.ts +12 -0
  307. package/vendor/native-preview/dist/enums/elementFlags.enum.d.ts.map +1 -0
  308. package/vendor/native-preview/dist/enums/elementFlags.enum.js +14 -0
  309. package/vendor/native-preview/dist/enums/elementFlags.enum.js.map +1 -0
  310. package/vendor/native-preview/dist/enums/elementFlags.js +14 -0
  311. package/vendor/native-preview/dist/enums/elementFlags.js.map +1 -0
  312. package/vendor/native-preview/dist/enums/languageVariant.d.ts +2 -0
  313. package/vendor/native-preview/dist/enums/languageVariant.d.ts.map +1 -0
  314. package/vendor/native-preview/dist/enums/languageVariant.enum.d.ts +5 -0
  315. package/vendor/native-preview/dist/enums/languageVariant.enum.d.ts.map +1 -0
  316. package/vendor/native-preview/dist/enums/languageVariant.enum.js +6 -0
  317. package/vendor/native-preview/dist/enums/languageVariant.enum.js.map +1 -0
  318. package/vendor/native-preview/dist/enums/languageVariant.js +6 -0
  319. package/vendor/native-preview/dist/enums/languageVariant.js.map +1 -0
  320. package/vendor/native-preview/dist/enums/modifierFlags.d.ts +2 -0
  321. package/vendor/native-preview/dist/enums/modifierFlags.d.ts.map +1 -0
  322. package/vendor/native-preview/dist/enums/modifierFlags.enum.d.ts +42 -0
  323. package/vendor/native-preview/dist/enums/modifierFlags.enum.d.ts.map +1 -0
  324. package/vendor/native-preview/dist/enums/modifierFlags.enum.js +44 -0
  325. package/vendor/native-preview/dist/enums/modifierFlags.enum.js.map +1 -0
  326. package/vendor/native-preview/dist/enums/modifierFlags.js +44 -0
  327. package/vendor/native-preview/dist/enums/modifierFlags.js.map +1 -0
  328. package/vendor/native-preview/dist/enums/nodeBuilderFlags.d.ts +2 -0
  329. package/vendor/native-preview/dist/enums/nodeBuilderFlags.d.ts.map +1 -0
  330. package/vendor/native-preview/dist/enums/nodeBuilderFlags.enum.d.ts +36 -0
  331. package/vendor/native-preview/dist/enums/nodeBuilderFlags.enum.d.ts.map +1 -0
  332. package/vendor/native-preview/dist/enums/nodeBuilderFlags.enum.js +38 -0
  333. package/vendor/native-preview/dist/enums/nodeBuilderFlags.enum.js.map +1 -0
  334. package/vendor/native-preview/dist/enums/nodeBuilderFlags.js +38 -0
  335. package/vendor/native-preview/dist/enums/nodeBuilderFlags.js.map +1 -0
  336. package/vendor/native-preview/dist/enums/nodeFlags.d.ts +2 -0
  337. package/vendor/native-preview/dist/enums/nodeFlags.d.ts.map +1 -0
  338. package/vendor/native-preview/dist/enums/nodeFlags.enum.d.ts +44 -0
  339. package/vendor/native-preview/dist/enums/nodeFlags.enum.d.ts.map +1 -0
  340. package/vendor/native-preview/dist/enums/nodeFlags.enum.js +46 -0
  341. package/vendor/native-preview/dist/enums/nodeFlags.enum.js.map +1 -0
  342. package/vendor/native-preview/dist/enums/nodeFlags.js +46 -0
  343. package/vendor/native-preview/dist/enums/nodeFlags.js.map +1 -0
  344. package/vendor/native-preview/dist/enums/objectFlags.d.ts +2 -0
  345. package/vendor/native-preview/dist/enums/objectFlags.d.ts.map +1 -0
  346. package/vendor/native-preview/dist/enums/objectFlags.enum.d.ts +50 -0
  347. package/vendor/native-preview/dist/enums/objectFlags.enum.d.ts.map +1 -0
  348. package/vendor/native-preview/dist/enums/objectFlags.enum.js +52 -0
  349. package/vendor/native-preview/dist/enums/objectFlags.enum.js.map +1 -0
  350. package/vendor/native-preview/dist/enums/objectFlags.js +52 -0
  351. package/vendor/native-preview/dist/enums/objectFlags.js.map +1 -0
  352. package/vendor/native-preview/dist/enums/outerExpressionKinds.d.ts +2 -0
  353. package/vendor/native-preview/dist/enums/outerExpressionKinds.d.ts.map +1 -0
  354. package/vendor/native-preview/dist/enums/outerExpressionKinds.enum.d.ts +16 -0
  355. package/vendor/native-preview/dist/enums/outerExpressionKinds.enum.d.ts.map +1 -0
  356. package/vendor/native-preview/dist/enums/outerExpressionKinds.enum.js +18 -0
  357. package/vendor/native-preview/dist/enums/outerExpressionKinds.enum.js.map +1 -0
  358. package/vendor/native-preview/dist/enums/outerExpressionKinds.js +18 -0
  359. package/vendor/native-preview/dist/enums/outerExpressionKinds.js.map +1 -0
  360. package/vendor/native-preview/dist/enums/regularExpressionFlags.d.ts +2 -0
  361. package/vendor/native-preview/dist/enums/regularExpressionFlags.d.ts.map +1 -0
  362. package/vendor/native-preview/dist/enums/regularExpressionFlags.enum.d.ts +13 -0
  363. package/vendor/native-preview/dist/enums/regularExpressionFlags.enum.d.ts.map +1 -0
  364. package/vendor/native-preview/dist/enums/regularExpressionFlags.enum.js +14 -0
  365. package/vendor/native-preview/dist/enums/regularExpressionFlags.enum.js.map +1 -0
  366. package/vendor/native-preview/dist/enums/regularExpressionFlags.js +14 -0
  367. package/vendor/native-preview/dist/enums/regularExpressionFlags.js.map +1 -0
  368. package/vendor/native-preview/dist/enums/scriptKind.d.ts +2 -0
  369. package/vendor/native-preview/dist/enums/scriptKind.d.ts.map +1 -0
  370. package/vendor/native-preview/dist/enums/scriptKind.enum.d.ts +11 -0
  371. package/vendor/native-preview/dist/enums/scriptKind.enum.d.ts.map +1 -0
  372. package/vendor/native-preview/dist/enums/scriptKind.enum.js +12 -0
  373. package/vendor/native-preview/dist/enums/scriptKind.enum.js.map +1 -0
  374. package/vendor/native-preview/dist/enums/scriptKind.js +12 -0
  375. package/vendor/native-preview/dist/enums/scriptKind.js.map +1 -0
  376. package/vendor/native-preview/dist/enums/scriptTarget.d.ts +2 -0
  377. package/vendor/native-preview/dist/enums/scriptTarget.d.ts.map +1 -0
  378. package/vendor/native-preview/dist/enums/scriptTarget.enum.d.ts +17 -0
  379. package/vendor/native-preview/dist/enums/scriptTarget.enum.d.ts.map +1 -0
  380. package/vendor/native-preview/dist/enums/scriptTarget.enum.js +18 -0
  381. package/vendor/native-preview/dist/enums/scriptTarget.enum.js.map +1 -0
  382. package/vendor/native-preview/dist/enums/scriptTarget.js +18 -0
  383. package/vendor/native-preview/dist/enums/scriptTarget.js.map +1 -0
  384. package/vendor/native-preview/dist/enums/signatureFlags.d.ts +2 -0
  385. package/vendor/native-preview/dist/enums/signatureFlags.d.ts.map +1 -0
  386. package/vendor/native-preview/dist/enums/signatureFlags.enum.d.ts +15 -0
  387. package/vendor/native-preview/dist/enums/signatureFlags.enum.d.ts.map +1 -0
  388. package/vendor/native-preview/dist/enums/signatureFlags.enum.js +17 -0
  389. package/vendor/native-preview/dist/enums/signatureFlags.enum.js.map +1 -0
  390. package/vendor/native-preview/dist/enums/signatureFlags.js +17 -0
  391. package/vendor/native-preview/dist/enums/signatureFlags.js.map +1 -0
  392. package/vendor/native-preview/dist/enums/signatureKind.d.ts +2 -0
  393. package/vendor/native-preview/dist/enums/signatureKind.d.ts.map +1 -0
  394. package/vendor/native-preview/dist/enums/signatureKind.enum.d.ts +5 -0
  395. package/vendor/native-preview/dist/enums/signatureKind.enum.d.ts.map +1 -0
  396. package/vendor/native-preview/dist/enums/signatureKind.enum.js +7 -0
  397. package/vendor/native-preview/dist/enums/signatureKind.enum.js.map +1 -0
  398. package/vendor/native-preview/dist/enums/signatureKind.js +7 -0
  399. package/vendor/native-preview/dist/enums/signatureKind.js.map +1 -0
  400. package/vendor/native-preview/dist/enums/symbolFlags.d.ts +2 -0
  401. package/vendor/native-preview/dist/enums/symbolFlags.d.ts.map +1 -0
  402. package/vendor/native-preview/dist/enums/symbolFlags.enum.d.ts +71 -0
  403. package/vendor/native-preview/dist/enums/symbolFlags.enum.d.ts.map +1 -0
  404. package/vendor/native-preview/dist/enums/symbolFlags.enum.js +73 -0
  405. package/vendor/native-preview/dist/enums/symbolFlags.enum.js.map +1 -0
  406. package/vendor/native-preview/dist/enums/symbolFlags.js +73 -0
  407. package/vendor/native-preview/dist/enums/symbolFlags.js.map +1 -0
  408. package/vendor/native-preview/dist/enums/syntaxKind.d.ts +2 -0
  409. package/vendor/native-preview/dist/enums/syntaxKind.d.ts.map +1 -0
  410. package/vendor/native-preview/dist/enums/syntaxKind.enum.d.ts +389 -0
  411. package/vendor/native-preview/dist/enums/syntaxKind.enum.d.ts.map +1 -0
  412. package/vendor/native-preview/dist/enums/syntaxKind.enum.js +391 -0
  413. package/vendor/native-preview/dist/enums/syntaxKind.enum.js.map +1 -0
  414. package/vendor/native-preview/dist/enums/syntaxKind.js +391 -0
  415. package/vendor/native-preview/dist/enums/syntaxKind.js.map +1 -0
  416. package/vendor/native-preview/dist/enums/tokenFlags.d.ts +2 -0
  417. package/vendor/native-preview/dist/enums/tokenFlags.d.ts.map +1 -0
  418. package/vendor/native-preview/dist/enums/tokenFlags.enum.d.ts +30 -0
  419. package/vendor/native-preview/dist/enums/tokenFlags.enum.d.ts.map +1 -0
  420. package/vendor/native-preview/dist/enums/tokenFlags.enum.js +32 -0
  421. package/vendor/native-preview/dist/enums/tokenFlags.enum.js.map +1 -0
  422. package/vendor/native-preview/dist/enums/tokenFlags.js +32 -0
  423. package/vendor/native-preview/dist/enums/tokenFlags.js.map +1 -0
  424. package/vendor/native-preview/dist/enums/typeFlags.d.ts +2 -0
  425. package/vendor/native-preview/dist/enums/typeFlags.d.ts.map +1 -0
  426. package/vendor/native-preview/dist/enums/typeFlags.enum.d.ts +76 -0
  427. package/vendor/native-preview/dist/enums/typeFlags.enum.d.ts.map +1 -0
  428. package/vendor/native-preview/dist/enums/typeFlags.enum.js +78 -0
  429. package/vendor/native-preview/dist/enums/typeFlags.enum.js.map +1 -0
  430. package/vendor/native-preview/dist/enums/typeFlags.js +78 -0
  431. package/vendor/native-preview/dist/enums/typeFlags.js.map +1 -0
  432. package/vendor/native-preview/dist/enums/typePredicateKind.d.ts +2 -0
  433. package/vendor/native-preview/dist/enums/typePredicateKind.d.ts.map +1 -0
  434. package/vendor/native-preview/dist/enums/typePredicateKind.enum.d.ts +7 -0
  435. package/vendor/native-preview/dist/enums/typePredicateKind.enum.d.ts.map +1 -0
  436. package/vendor/native-preview/dist/enums/typePredicateKind.enum.js +9 -0
  437. package/vendor/native-preview/dist/enums/typePredicateKind.enum.js.map +1 -0
  438. package/vendor/native-preview/dist/enums/typePredicateKind.js +9 -0
  439. package/vendor/native-preview/dist/enums/typePredicateKind.js.map +1 -0
  440. package/vendor/native-preview/lib/getExePath.d.ts +2 -0
  441. package/vendor/native-preview/lib/getExePath.js +70 -0
  442. package/vendor/native-preview/lib/tsgo.js +28 -0
  443. package/vendor/native-preview/lib/version.cjs +3 -0
  444. package/vendor/native-preview/lib/version.d.cts +2 -0
  445. package/vendor/native-preview/package.json +118 -0
  446. package/vendor/native-preview/tsconfig.tsbuildinfo +1 -0
  447. package/vendor/native-preview/vendor/vscode-jsonrpc/License.txt +11 -0
  448. package/vendor/native-preview/vendor/vscode-jsonrpc/README.md +54 -0
  449. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/browser/main.d.ts +17 -0
  450. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/browser/main.js +83 -0
  451. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/browser/ril.d.ts +22 -0
  452. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/browser/ril.js +210 -0
  453. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/api.d.ts +14 -0
  454. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/api.js +87 -0
  455. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/cancellation.d.ts +32 -0
  456. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/cancellation.js +132 -0
  457. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/connection.d.ts +367 -0
  458. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/connection.js +1271 -0
  459. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/disposable.d.ts +9 -0
  460. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/disposable.js +16 -0
  461. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/encoding.d.ts +52 -0
  462. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/encoding.js +70 -0
  463. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/events.d.ts +39 -0
  464. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/events.js +135 -0
  465. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/is.d.ts +7 -0
  466. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/is.js +34 -0
  467. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/linkedMap.d.ts +55 -0
  468. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/linkedMap.js +412 -0
  469. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/messageBuffer.d.ts +18 -0
  470. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/messageBuffer.js +155 -0
  471. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/messageReader.d.ts +77 -0
  472. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/messageReader.js +246 -0
  473. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/messageWriter.d.ts +60 -0
  474. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/messageWriter.js +157 -0
  475. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/messages.d.ts +369 -0
  476. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/messages.js +436 -0
  477. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/ral.d.ts +74 -0
  478. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/ral.js +23 -0
  479. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/semaphore.d.ts +10 -0
  480. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/semaphore.js +74 -0
  481. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/sharedArrayCancellation.d.ts +15 -0
  482. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/sharedArrayCancellation.js +77 -0
  483. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/node/main.d.ts +58 -0
  484. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/node/main.js +289 -0
  485. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/node/ril.d.ts +12 -0
  486. package/vendor/native-preview/vendor/vscode-jsonrpc/lib/node/ril.js +163 -0
  487. package/vendor/native-preview/vendor/vscode-jsonrpc/package.json +54 -0
  488. package/vendor/native-preview/vendor/vscode-jsonrpc/typings/thenable.d.ts +5 -0
@@ -0,0 +1,1467 @@
1
+ /// <reference path="../node/node.ts" preserve="true" />
2
+ import { CompletionItemKind } from "#enums/completionItemKind";
3
+ import { DiagnosticCategory } from "#enums/diagnosticCategory";
4
+ import { ElementFlags } from "#enums/elementFlags";
5
+ import { NodeBuilderFlags } from "#enums/nodeBuilderFlags";
6
+ import { ObjectFlags } from "#enums/objectFlags";
7
+ import { SignatureFlags } from "#enums/signatureFlags";
8
+ import { SignatureKind } from "#enums/signatureKind";
9
+ import { SymbolFlags } from "#enums/symbolFlags";
10
+ import { TypeFlags } from "#enums/typeFlags";
11
+ import { TypePredicateKind } from "#enums/typePredicateKind";
12
+ import { ModifierFlags, } from "../../ast/index.js";
13
+ import { encodeNode, uint8ArrayToBase64, } from "../node/encoder.js";
14
+ import { decodeNode, getNodeId, parseNodeHandle, readParseOptionsKey, readSourceFileHash, RemoteSourceFile, } from "../node/node.js";
15
+ import { createGetCanonicalFileName, toPath, } from "../path.js";
16
+ import { resolveFileName, toUpdateSnapshotRequest, } from "../proto.js";
17
+ import { SourceFileCache } from "../sourceFileCache.js";
18
+ import { Client, } from "./client.js";
19
+ export { CompletionItemKind, DiagnosticCategory, ElementFlags, ModifierFlags, NodeBuilderFlags, ObjectFlags, SignatureFlags, SignatureKind, SymbolFlags, TypeFlags, TypePredicateKind };
20
+ export { documentURIToFileName, fileNameToDocumentURI } from "../path.js";
21
+ export class API {
22
+ client;
23
+ sourceFileCache;
24
+ toPath;
25
+ initialized = false;
26
+ activeSnapshots = new Set();
27
+ latestSnapshot;
28
+ internal;
29
+ constructor(options) {
30
+ this.client = new Client(options);
31
+ this.sourceFileCache = new SourceFileCache();
32
+ this.internal = new InternalAPI(this.client, () => this.ensureInitialized());
33
+ }
34
+ /**
35
+ * Create an API instance from an existing LSP connection's API session.
36
+ * Use this when connecting to an API pipe provided by an LSP server via custom/initializeAPISession.
37
+ */
38
+ static async fromLSPConnection(options) {
39
+ const api = new API(options);
40
+ await api.ensureInitialized();
41
+ return api;
42
+ }
43
+ async ensureInitialized() {
44
+ if (!this.initialized) {
45
+ const response = await this.client.apiRequest("initialize", null);
46
+ const getCanonicalFileName = createGetCanonicalFileName(response.useCaseSensitiveFileNames);
47
+ const currentDirectory = response.currentDirectory;
48
+ this.toPath = (fileName) => toPath(fileName, currentDirectory, getCanonicalFileName);
49
+ this.initialized = true;
50
+ }
51
+ }
52
+ async parseConfigFile(file) {
53
+ await this.ensureInitialized();
54
+ return this.client.apiRequest("parseConfigFile", { file });
55
+ }
56
+ async updateSnapshot(params) {
57
+ await this.ensureInitialized();
58
+ const requestParams = toUpdateSnapshotRequest(params);
59
+ const data = await this.client.apiRequest("updateSnapshot", requestParams);
60
+ // Retain cached source files from previous snapshot for unchanged files
61
+ if (this.latestSnapshot) {
62
+ this.sourceFileCache.retainForSnapshot(data.snapshot, this.latestSnapshot.id, data.changes);
63
+ if (this.latestSnapshot.isDisposed()) {
64
+ this.sourceFileCache.releaseSnapshot(this.latestSnapshot.id);
65
+ }
66
+ }
67
+ const snapshot = new Snapshot(data, this.client, this.sourceFileCache, this.toPath, () => {
68
+ this.activeSnapshots.delete(snapshot);
69
+ if (snapshot !== this.latestSnapshot) {
70
+ this.sourceFileCache.releaseSnapshot(snapshot.id);
71
+ }
72
+ });
73
+ this.latestSnapshot = snapshot;
74
+ this.activeSnapshots.add(snapshot);
75
+ return snapshot;
76
+ }
77
+ async close() {
78
+ // Dispose all active snapshots
79
+ for (const snapshot of [...this.activeSnapshots]) {
80
+ await snapshot.dispose();
81
+ }
82
+ // Release the latest snapshot's cache refs if still held
83
+ if (this.latestSnapshot) {
84
+ this.sourceFileCache.releaseSnapshot(this.latestSnapshot.id);
85
+ this.latestSnapshot = undefined;
86
+ }
87
+ await this.client.close();
88
+ this.sourceFileCache.clear();
89
+ }
90
+ clearSourceFileCache() {
91
+ this.sourceFileCache.clear();
92
+ }
93
+ }
94
+ export class InternalAPI {
95
+ client;
96
+ ensureInitialized;
97
+ /** @internal */
98
+ constructor(client, ensureInitialized) {
99
+ this.client = client;
100
+ this.ensureInitialized = ensureInitialized;
101
+ }
102
+ async startCPUProfile(dir) {
103
+ await this.ensureInitialized();
104
+ await this.client.apiRequest("startCPUProfile", { dir });
105
+ }
106
+ async stopCPUProfile() {
107
+ await this.ensureInitialized();
108
+ const result = await this.client.apiRequest("stopCPUProfile", null);
109
+ return result.file;
110
+ }
111
+ async saveHeapProfile(dir) {
112
+ await this.ensureInitialized();
113
+ const result = await this.client.apiRequest("saveHeapProfile", { dir });
114
+ return result.file;
115
+ }
116
+ }
117
+ export class Snapshot {
118
+ id;
119
+ projectMap;
120
+ toPath;
121
+ client;
122
+ disposed = false;
123
+ onDispose;
124
+ snapshotRegistry;
125
+ constructor(data, client, sourceFileCache, toPath, onDispose) {
126
+ this.id = data.snapshot;
127
+ this.client = client;
128
+ this.toPath = toPath;
129
+ this.onDispose = onDispose;
130
+ this.snapshotRegistry = new SnapshotObjectRegistry(client, this.id);
131
+ this.projectMap = new Map();
132
+ for (const projData of data.projects) {
133
+ const project = new Project(projData, this.id, client, sourceFileCache, toPath, this.snapshotRegistry);
134
+ this.projectMap.set(toPath(projData.configFileName), project);
135
+ }
136
+ }
137
+ getProjects() {
138
+ this.ensureNotDisposed();
139
+ return [...this.projectMap.values()];
140
+ }
141
+ getProject(configFileName) {
142
+ this.ensureNotDisposed();
143
+ return this.projectMap.get(this.toPath(configFileName));
144
+ }
145
+ async getDefaultProjectForFile(file) {
146
+ this.ensureNotDisposed();
147
+ const data = await this.client.apiRequest("getDefaultProjectForFile", {
148
+ snapshot: this.id,
149
+ file,
150
+ });
151
+ if (!data)
152
+ return undefined;
153
+ return this.projectMap.get(this.toPath(data.configFileName));
154
+ }
155
+ [globalThis.Symbol.dispose]() {
156
+ this.dispose();
157
+ }
158
+ async dispose() {
159
+ if (this.disposed)
160
+ return;
161
+ this.disposed = true;
162
+ for (const project of this.projectMap.values()) {
163
+ project.dispose();
164
+ }
165
+ this.projectMap.clear();
166
+ this.snapshotRegistry.clear();
167
+ this.onDispose();
168
+ await this.client.apiRequest("release", { snapshot: this.id });
169
+ }
170
+ isDisposed() {
171
+ return this.disposed;
172
+ }
173
+ ensureNotDisposed() {
174
+ if (this.disposed) {
175
+ throw new Error("Snapshot is disposed");
176
+ }
177
+ }
178
+ }
179
+ class SnapshotObjectRegistry {
180
+ symbols = new Map();
181
+ client;
182
+ snapshotId;
183
+ constructor(client, snapshotId) {
184
+ this.client = client;
185
+ this.snapshotId = snapshotId;
186
+ }
187
+ getOrCreateSymbol(data) {
188
+ let symbol = this.symbols.get(data.id);
189
+ if (!symbol) {
190
+ symbol = new Symbol(data, this);
191
+ this.symbols.set(data.id, symbol);
192
+ }
193
+ return symbol;
194
+ }
195
+ getSymbol(id) {
196
+ return this.symbols.get(id);
197
+ }
198
+ clear() {
199
+ this.symbols.clear();
200
+ }
201
+ async fetchSymbol(source, method, handle, projectId) {
202
+ if (!handle)
203
+ return undefined;
204
+ const cached = this.getSymbol(handle);
205
+ if (cached)
206
+ return cached;
207
+ const data = await this.client.apiRequest(method, {
208
+ snapshot: this.snapshotId,
209
+ project: projectId,
210
+ objectId: source.id,
211
+ });
212
+ if (!data)
213
+ throw new Error(`${method} returned null symbol for ${source.constructor.name} ${source.id}`);
214
+ return this.getOrCreateSymbol(data);
215
+ }
216
+ async fetchSymbols(source, method, handles, projectId) {
217
+ if (handles) {
218
+ const result = new Array(handles.length);
219
+ let allCached = true;
220
+ for (let i = 0; i < handles.length; i++) {
221
+ const cached = this.getSymbol(handles[i]);
222
+ if (!cached) {
223
+ allCached = false;
224
+ break;
225
+ }
226
+ result[i] = cached;
227
+ }
228
+ if (allCached)
229
+ return result;
230
+ }
231
+ const symbolData = await this.client.apiRequest(method, {
232
+ snapshot: this.snapshotId,
233
+ project: projectId,
234
+ objectId: source.id,
235
+ });
236
+ if (symbolData == null)
237
+ return [];
238
+ else
239
+ return symbolData.map(data => this.getOrCreateSymbol(data));
240
+ }
241
+ }
242
+ class ProjectObjectRegistry {
243
+ client;
244
+ snapshotId;
245
+ projectId;
246
+ snapshotRegistry;
247
+ types = new Map();
248
+ signatures = new Map();
249
+ constructor(client, snapshotId, projectId, snapshotRegistry) {
250
+ this.client = client;
251
+ this.snapshotId = snapshotId;
252
+ this.projectId = projectId;
253
+ this.snapshotRegistry = snapshotRegistry;
254
+ }
255
+ getOrCreateSymbol(data) {
256
+ return this.snapshotRegistry.getOrCreateSymbol(data);
257
+ }
258
+ getSymbol(id) {
259
+ return this.snapshotRegistry.getSymbol(id);
260
+ }
261
+ getOrCreateType(data) {
262
+ let type = this.types.get(data.id);
263
+ if (!type) {
264
+ type = new TypeObject(data, this);
265
+ this.types.set(data.id, type);
266
+ }
267
+ return type;
268
+ }
269
+ getType(id) {
270
+ return this.types.get(id);
271
+ }
272
+ getOrCreateSignature(data) {
273
+ let sig = this.signatures.get(data.id);
274
+ if (!sig) {
275
+ sig = new Signature(data, this);
276
+ this.signatures.set(data.id, sig);
277
+ }
278
+ return sig;
279
+ }
280
+ getSignature(id) {
281
+ return this.signatures.get(id);
282
+ }
283
+ clear() {
284
+ this.types.clear();
285
+ this.signatures.clear();
286
+ }
287
+ async fetchType(source, method, handle) {
288
+ if (handle !== false) {
289
+ if (!handle)
290
+ return undefined;
291
+ const cached = this.getType(handle);
292
+ if (cached)
293
+ return cached;
294
+ }
295
+ const data = await this.client.apiRequest(method, {
296
+ snapshot: this.snapshotId,
297
+ project: this.projectId,
298
+ objectId: source.id,
299
+ });
300
+ if (!data)
301
+ throw new Error(`${method} returned null type for ${source.constructor.name} ${source.id}`);
302
+ return this.getOrCreateType(data);
303
+ }
304
+ async fetchSymbol(source, method, handle) {
305
+ return this.snapshotRegistry.fetchSymbol(source, method, handle, this.projectId);
306
+ }
307
+ async fetchSignature(source, method, handle) {
308
+ if (!handle)
309
+ return undefined;
310
+ const cached = this.getSignature(handle);
311
+ if (cached)
312
+ return cached;
313
+ const data = await this.client.apiRequest(method, {
314
+ snapshot: this.snapshotId,
315
+ project: this.projectId,
316
+ objectId: source.id,
317
+ });
318
+ if (!data)
319
+ throw new Error(`${method} returned null signature for ${source.constructor.name} ${source.id}`);
320
+ return this.getOrCreateSignature(data);
321
+ }
322
+ async fetchTypes(source, method, handles) {
323
+ if (handles) {
324
+ const result = new Array(handles.length);
325
+ let allCached = true;
326
+ for (let i = 0; i < handles.length; i++) {
327
+ const cached = this.getType(handles[i]);
328
+ if (!cached) {
329
+ allCached = false;
330
+ break;
331
+ }
332
+ result[i] = cached;
333
+ }
334
+ if (allCached)
335
+ return result;
336
+ }
337
+ const typesData = await this.client.apiRequest(method, {
338
+ snapshot: this.snapshotId,
339
+ project: this.projectId,
340
+ objectId: source.id,
341
+ });
342
+ if (typesData == null)
343
+ return [];
344
+ else
345
+ return typesData.map(data => this.getOrCreateType(data));
346
+ }
347
+ async fetchSymbols(source, method, handles) {
348
+ return this.snapshotRegistry.fetchSymbols(source, method, handles, this.projectId);
349
+ }
350
+ }
351
+ export class Project {
352
+ id;
353
+ configFileName;
354
+ compilerOptions;
355
+ rootFiles;
356
+ program;
357
+ checker;
358
+ emitter;
359
+ client;
360
+ constructor(data, snapshotId, client, sourceFileCache, toPath, snapshotRegistry) {
361
+ this.id = data.id;
362
+ this.configFileName = data.configFileName;
363
+ this.compilerOptions = data.compilerOptions;
364
+ this.rootFiles = data.rootFiles;
365
+ this.client = client;
366
+ this.program = new Program(snapshotId, this.id, client, sourceFileCache, toPath);
367
+ const objectRegistry = new ProjectObjectRegistry(client, snapshotId, this.id, snapshotRegistry);
368
+ this.checker = new Checker(snapshotId, this.id, client, objectRegistry);
369
+ this.emitter = new Emitter(client);
370
+ }
371
+ dispose() {
372
+ this.checker.dispose();
373
+ }
374
+ }
375
+ export class Program {
376
+ snapshotId;
377
+ projectId;
378
+ client;
379
+ sourceFileCache;
380
+ toPath;
381
+ decoder = new TextDecoder();
382
+ constructor(snapshotId, projectId, client, sourceFileCache, toPath) {
383
+ this.snapshotId = snapshotId;
384
+ this.projectId = projectId;
385
+ this.client = client;
386
+ this.sourceFileCache = sourceFileCache;
387
+ this.toPath = toPath;
388
+ }
389
+ async getSourceFile(file) {
390
+ const fileName = resolveFileName(file);
391
+ const path = this.toPath(fileName);
392
+ // Check if we already have a retained cache entry for this (snapshot, project) pair
393
+ const retained = this.sourceFileCache.getRetained(path, this.snapshotId, this.projectId);
394
+ if (retained) {
395
+ return retained;
396
+ }
397
+ // Fetch from server
398
+ const binaryData = await this.client.apiRequestBinary("getSourceFile", {
399
+ snapshot: this.snapshotId,
400
+ project: this.projectId,
401
+ file,
402
+ });
403
+ if (!binaryData) {
404
+ return undefined;
405
+ }
406
+ const view = new DataView(binaryData.buffer, binaryData.byteOffset, binaryData.byteLength);
407
+ const contentHash = readSourceFileHash(view);
408
+ const parseOptionsKey = readParseOptionsKey(view);
409
+ // Create a new RemoteSourceFile and cache it (set returns existing if hash matches)
410
+ const sourceFile = new RemoteSourceFile(binaryData, this.decoder);
411
+ return this.sourceFileCache.set(path, sourceFile, parseOptionsKey, contentHash, this.snapshotId, this.projectId);
412
+ }
413
+ async getSourceFileNames() {
414
+ const data = await this.client.apiRequest("getSourceFileNames", {
415
+ snapshot: this.snapshotId,
416
+ project: this.projectId,
417
+ });
418
+ return data ?? [];
419
+ }
420
+ /**
421
+ * Get syntactic (parse) diagnostics for a specific file or all files.
422
+ * @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
423
+ */
424
+ async getSyntacticDiagnostics(file) {
425
+ const data = await this.client.apiRequest("getSyntacticDiagnostics", {
426
+ snapshot: this.snapshotId,
427
+ project: this.projectId,
428
+ ...(file !== undefined ? { file } : {}),
429
+ });
430
+ return data ?? [];
431
+ }
432
+ /**
433
+ * Get binder diagnostics for a specific file or all files.
434
+ * @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
435
+ */
436
+ async getBindDiagnostics(file) {
437
+ const data = await this.client.apiRequest("getBindDiagnostics", {
438
+ snapshot: this.snapshotId,
439
+ project: this.projectId,
440
+ ...(file !== undefined ? { file } : {}),
441
+ });
442
+ return data ?? [];
443
+ }
444
+ /**
445
+ * Get semantic (type-check) diagnostics for a specific file or all files.
446
+ * @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
447
+ */
448
+ async getSemanticDiagnostics(file) {
449
+ const data = await this.client.apiRequest("getSemanticDiagnostics", {
450
+ snapshot: this.snapshotId,
451
+ project: this.projectId,
452
+ ...(file !== undefined ? { file } : {}),
453
+ });
454
+ return data ?? [];
455
+ }
456
+ /**
457
+ * Get suggestion diagnostics for a specific file or all files.
458
+ * @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
459
+ */
460
+ async getSuggestionDiagnostics(file) {
461
+ const data = await this.client.apiRequest("getSuggestionDiagnostics", {
462
+ snapshot: this.snapshotId,
463
+ project: this.projectId,
464
+ ...(file !== undefined ? { file } : {}),
465
+ });
466
+ return data ?? [];
467
+ }
468
+ /**
469
+ * Get declaration emit diagnostics for a specific file or all files.
470
+ * @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
471
+ */
472
+ async getDeclarationDiagnostics(file) {
473
+ const data = await this.client.apiRequest("getDeclarationDiagnostics", {
474
+ snapshot: this.snapshotId,
475
+ project: this.projectId,
476
+ ...(file !== undefined ? { file } : {}),
477
+ });
478
+ return data ?? [];
479
+ }
480
+ /**
481
+ * Get program-wide diagnostics for the project, including compiler options diagnostics.
482
+ */
483
+ async getProgramDiagnostics() {
484
+ const data = await this.client.apiRequest("getProgramDiagnostics", {
485
+ snapshot: this.snapshotId,
486
+ project: this.projectId,
487
+ });
488
+ return data ?? [];
489
+ }
490
+ /**
491
+ * Get global (non-file-specific) semantic diagnostics for the project.
492
+ */
493
+ async getGlobalDiagnostics() {
494
+ const data = await this.client.apiRequest("getGlobalDiagnostics", {
495
+ snapshot: this.snapshotId,
496
+ project: this.projectId,
497
+ });
498
+ return data ?? [];
499
+ }
500
+ /**
501
+ * Get config file parsing diagnostics for the project.
502
+ */
503
+ async getConfigFileParsingDiagnostics() {
504
+ const data = await this.client.apiRequest("getConfigFileParsingDiagnostics", {
505
+ snapshot: this.snapshotId,
506
+ project: this.projectId,
507
+ });
508
+ return data ?? [];
509
+ }
510
+ }
511
+ export class Checker {
512
+ snapshotId;
513
+ projectId;
514
+ client;
515
+ objectRegistry;
516
+ constructor(snapshotId, projectId, client, objectRegistry) {
517
+ this.snapshotId = snapshotId;
518
+ this.projectId = projectId;
519
+ this.client = client;
520
+ this.objectRegistry = objectRegistry;
521
+ }
522
+ dispose() {
523
+ this.objectRegistry.clear();
524
+ }
525
+ async getSymbolAtLocation(nodeOrNodes) {
526
+ if (Array.isArray(nodeOrNodes)) {
527
+ const data = await this.client.apiRequest("getSymbolsAtLocations", {
528
+ snapshot: this.snapshotId,
529
+ project: this.projectId,
530
+ locations: nodeOrNodes.map(node => getNodeId(node)),
531
+ });
532
+ return data.map(d => d ? this.objectRegistry.getOrCreateSymbol(d) : undefined);
533
+ }
534
+ const data = await this.client.apiRequest("getSymbolAtLocation", {
535
+ snapshot: this.snapshotId,
536
+ project: this.projectId,
537
+ location: getNodeId(nodeOrNodes),
538
+ });
539
+ return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
540
+ }
541
+ async getSymbolAtPosition(file, positionOrPositions) {
542
+ if (typeof positionOrPositions === "number") {
543
+ const data = await this.client.apiRequest("getSymbolAtPosition", {
544
+ snapshot: this.snapshotId,
545
+ project: this.projectId,
546
+ file,
547
+ position: positionOrPositions,
548
+ });
549
+ return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
550
+ }
551
+ const data = await this.client.apiRequest("getSymbolsAtPositions", {
552
+ snapshot: this.snapshotId,
553
+ project: this.projectId,
554
+ file,
555
+ positions: positionOrPositions,
556
+ });
557
+ return data.map(d => d ? this.objectRegistry.getOrCreateSymbol(d) : undefined);
558
+ }
559
+ /** Batch-resolves symbols at every Identifier in a file (one RPC). Light symbol payloads. */
560
+ async getResolvedReferencesInFile(file) {
561
+ const data = await this.client.apiRequest("getResolvedReferencesInFile", {
562
+ snapshot: this.snapshotId,
563
+ project: this.projectId,
564
+ file,
565
+ });
566
+ return data ?? { references: [], symbols: [] };
567
+ }
568
+ /** Register light symbols and return end-position → Symbol map for scope-manager prefetch. */
569
+ async prefetchResolvedReferences(file) {
570
+ const data = await this.getResolvedReferencesInFile(file);
571
+ const byId = new Map();
572
+ for (const s of data.symbols) {
573
+ byId.set(s.id, this.objectRegistry.getOrCreateSymbol(s));
574
+ }
575
+ const byPos = new Map();
576
+ for (const ref of data.references) {
577
+ byPos.set(ref.position, byId.get(ref.symbolId));
578
+ }
579
+ return byPos;
580
+ }
581
+ async getTypeOfSymbol(symbolOrSymbols) {
582
+ if (Array.isArray(symbolOrSymbols)) {
583
+ const data = await this.client.apiRequest("getTypesOfSymbols", {
584
+ snapshot: this.snapshotId,
585
+ project: this.projectId,
586
+ symbols: symbolOrSymbols.map(s => s.id),
587
+ });
588
+ return data.map(d => d ? this.objectRegistry.getOrCreateType(d) : undefined);
589
+ }
590
+ const data = await this.client.apiRequest("getTypeOfSymbol", {
591
+ snapshot: this.snapshotId,
592
+ project: this.projectId,
593
+ symbol: symbolOrSymbols.id,
594
+ });
595
+ return data ? this.objectRegistry.getOrCreateType(data) : undefined;
596
+ }
597
+ async getDeclaredTypeOfSymbol(symbol) {
598
+ const data = await this.client.apiRequest("getDeclaredTypeOfSymbol", {
599
+ snapshot: this.snapshotId,
600
+ project: this.projectId,
601
+ symbol: symbol.id,
602
+ });
603
+ return data ? this.objectRegistry.getOrCreateType(data) : undefined;
604
+ }
605
+ async getReferencesToSymbolInFile(file, symbol) {
606
+ const data = await this.client.apiRequest("getReferencesToSymbolInFile", {
607
+ snapshot: this.snapshotId,
608
+ project: this.projectId,
609
+ file,
610
+ symbol: symbol.id,
611
+ });
612
+ return (data ?? []).map(h => new NodeHandle(h));
613
+ }
614
+ async getReferencedSymbolsForNode(node, position) {
615
+ const data = await this.client.apiRequest("getReferencedSymbolsForNode", {
616
+ snapshot: this.snapshotId,
617
+ project: this.projectId,
618
+ node: getNodeId(node),
619
+ position,
620
+ });
621
+ return (data ?? []).map(entry => ({
622
+ definition: new NodeHandle(entry.definition),
623
+ symbol: entry.symbol ? this.objectRegistry.getOrCreateSymbol(entry.symbol) : undefined,
624
+ references: (entry.references ?? []).map(h => new NodeHandle(h)),
625
+ }));
626
+ }
627
+ async getSignatureUsage(signatureDecl) {
628
+ const data = await this.client.apiRequest("getSignatureUsages", {
629
+ snapshot: this.snapshotId,
630
+ project: this.projectId,
631
+ signatureDecl: getNodeId(signatureDecl),
632
+ });
633
+ return (data ?? []).map(entry => ({
634
+ name: new NodeHandle(entry.name),
635
+ call: entry.call ? new NodeHandle(entry.call) : undefined,
636
+ }));
637
+ }
638
+ async getCompletionsAtPosition(document, position, options) {
639
+ const data = await this.client.apiRequest("getCompletionsAtPosition", {
640
+ snapshot: this.snapshotId,
641
+ project: this.projectId,
642
+ file: document,
643
+ position,
644
+ triggerCharacter: options?.triggerCharacter,
645
+ includeSymbol: options?.includeSymbol,
646
+ });
647
+ if (!data)
648
+ return undefined;
649
+ return {
650
+ isIncomplete: data.isIncomplete,
651
+ entries: data.entries.map(e => ({
652
+ ...e,
653
+ symbol: e.symbol ? this.objectRegistry.getOrCreateSymbol(e.symbol) : undefined,
654
+ })),
655
+ };
656
+ }
657
+ async getTypeAtLocation(nodeOrNodes) {
658
+ if (Array.isArray(nodeOrNodes)) {
659
+ const data = await this.client.apiRequest("getTypeAtLocations", {
660
+ snapshot: this.snapshotId,
661
+ project: this.projectId,
662
+ locations: nodeOrNodes.map(node => getNodeId(node)),
663
+ });
664
+ return data.map(d => d ? this.objectRegistry.getOrCreateType(d) : undefined);
665
+ }
666
+ const data = await this.client.apiRequest("getTypeAtLocation", {
667
+ snapshot: this.snapshotId,
668
+ project: this.projectId,
669
+ location: getNodeId(nodeOrNodes),
670
+ });
671
+ return data ? this.objectRegistry.getOrCreateType(data) : undefined;
672
+ }
673
+ async getSignaturesOfType(type, kind) {
674
+ const data = await this.client.apiRequest("getSignaturesOfType", {
675
+ snapshot: this.snapshotId,
676
+ project: this.projectId,
677
+ type: type.id,
678
+ kind,
679
+ });
680
+ return data.map(d => this.objectRegistry.getOrCreateSignature(d));
681
+ }
682
+ async getResolvedSignature(node) {
683
+ const data = await this.client.apiRequest("getResolvedSignature", {
684
+ snapshot: this.snapshotId,
685
+ project: this.projectId,
686
+ location: getNodeId(node),
687
+ });
688
+ return data ? this.objectRegistry.getOrCreateSignature(data) : undefined;
689
+ }
690
+ async getTypeAtPosition(file, positionOrPositions) {
691
+ if (typeof positionOrPositions === "number") {
692
+ const data = await this.client.apiRequest("getTypeAtPosition", {
693
+ snapshot: this.snapshotId,
694
+ project: this.projectId,
695
+ file,
696
+ position: positionOrPositions,
697
+ });
698
+ return data ? this.objectRegistry.getOrCreateType(data) : undefined;
699
+ }
700
+ const data = await this.client.apiRequest("getTypesAtPositions", {
701
+ snapshot: this.snapshotId,
702
+ project: this.projectId,
703
+ file,
704
+ positions: positionOrPositions,
705
+ });
706
+ return data.map(d => d ? this.objectRegistry.getOrCreateType(d) : undefined);
707
+ }
708
+ async resolveName(name, meaning, location, excludeGlobals) {
709
+ // Distinguish Node (has `kind`) from DocumentPosition (has `document` and `position`)
710
+ const isNode = location && "kind" in location;
711
+ const data = await this.client.apiRequest("resolveName", {
712
+ snapshot: this.snapshotId,
713
+ project: this.projectId,
714
+ name,
715
+ meaning,
716
+ location: isNode ? getNodeId(location) : undefined,
717
+ file: !isNode && location ? location.document : undefined,
718
+ position: !isNode && location ? location.position : undefined,
719
+ excludeGlobals,
720
+ });
721
+ return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
722
+ }
723
+ async getResolvedSymbol(node) {
724
+ const text = node.text;
725
+ if (!text)
726
+ return undefined;
727
+ return this.resolveName(text, SymbolFlags.Value | SymbolFlags.ExportValue, node);
728
+ }
729
+ async getContextualType(node) {
730
+ const data = await this.client.apiRequest("getContextualType", {
731
+ snapshot: this.snapshotId,
732
+ project: this.projectId,
733
+ location: getNodeId(node),
734
+ });
735
+ return data ? this.objectRegistry.getOrCreateType(data) : undefined;
736
+ }
737
+ async getBaseTypeOfLiteralType(type) {
738
+ const data = await this.client.apiRequest("getBaseTypeOfLiteralType", {
739
+ snapshot: this.snapshotId,
740
+ project: this.projectId,
741
+ type: type.id,
742
+ });
743
+ return data ? this.objectRegistry.getOrCreateType(data) : undefined;
744
+ }
745
+ async getNonNullableType(type) {
746
+ const data = await this.client.apiRequest("getNonNullableType", {
747
+ snapshot: this.snapshotId,
748
+ project: this.projectId,
749
+ type: type.id,
750
+ });
751
+ return data ? this.objectRegistry.getOrCreateType(data) : undefined;
752
+ }
753
+ async getTypeFromTypeNode(node) {
754
+ const data = await this.client.apiRequest("getTypeFromTypeNode", {
755
+ snapshot: this.snapshotId,
756
+ project: this.projectId,
757
+ location: getNodeId(node),
758
+ });
759
+ return data ? this.objectRegistry.getOrCreateType(data) : undefined;
760
+ }
761
+ async getWidenedType(type) {
762
+ const data = await this.client.apiRequest("getWidenedType", {
763
+ snapshot: this.snapshotId,
764
+ project: this.projectId,
765
+ type: type.id,
766
+ });
767
+ return data ? this.objectRegistry.getOrCreateType(data) : undefined;
768
+ }
769
+ async getParameterType(signature, index) {
770
+ const data = await this.client.apiRequest("getParameterType", {
771
+ snapshot: this.snapshotId,
772
+ project: this.projectId,
773
+ signature: signature.id,
774
+ index,
775
+ });
776
+ return data ? this.objectRegistry.getOrCreateType(data) : undefined;
777
+ }
778
+ async isArrayLikeType(type) {
779
+ return this.client.apiRequest("isArrayLikeType", {
780
+ snapshot: this.snapshotId,
781
+ project: this.projectId,
782
+ type: type.id,
783
+ });
784
+ }
785
+ async isTypeAssignableTo(source, target) {
786
+ return this.client.apiRequest("isTypeAssignableTo", {
787
+ snapshot: this.snapshotId,
788
+ project: this.projectId,
789
+ source: source.id,
790
+ target: target.id,
791
+ });
792
+ }
793
+ async getShorthandAssignmentValueSymbol(node) {
794
+ const data = await this.client.apiRequest("getShorthandAssignmentValueSymbol", {
795
+ snapshot: this.snapshotId,
796
+ project: this.projectId,
797
+ location: getNodeId(node),
798
+ });
799
+ return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
800
+ }
801
+ async getTypeOfSymbolAtLocation(symbol, location) {
802
+ const data = await this.client.apiRequest("getTypeOfSymbolAtLocation", {
803
+ snapshot: this.snapshotId,
804
+ project: this.projectId,
805
+ symbol: symbol.id,
806
+ location: getNodeId(location),
807
+ });
808
+ return data ? this.objectRegistry.getOrCreateType(data) : undefined;
809
+ }
810
+ async getIntrinsicType(method) {
811
+ const data = await this.client.apiRequest(method, {
812
+ snapshot: this.snapshotId,
813
+ project: this.projectId,
814
+ });
815
+ return this.objectRegistry.getOrCreateType(data);
816
+ }
817
+ async getAnyType() {
818
+ return this.getIntrinsicType("getAnyType");
819
+ }
820
+ async getStringType() {
821
+ return this.getIntrinsicType("getStringType");
822
+ }
823
+ async getNumberType() {
824
+ return this.getIntrinsicType("getNumberType");
825
+ }
826
+ async getBooleanType() {
827
+ return this.getIntrinsicType("getBooleanType");
828
+ }
829
+ async getVoidType() {
830
+ return this.getIntrinsicType("getVoidType");
831
+ }
832
+ async getUndefinedType() {
833
+ return this.getIntrinsicType("getUndefinedType");
834
+ }
835
+ async getNullType() {
836
+ return this.getIntrinsicType("getNullType");
837
+ }
838
+ async getNeverType() {
839
+ return this.getIntrinsicType("getNeverType");
840
+ }
841
+ async getUnknownType() {
842
+ return this.getIntrinsicType("getUnknownType");
843
+ }
844
+ async getBigIntType() {
845
+ return this.getIntrinsicType("getBigIntType");
846
+ }
847
+ async getESSymbolType() {
848
+ return this.getIntrinsicType("getESSymbolType");
849
+ }
850
+ async typeToTypeNode(type, enclosingDeclaration, flags) {
851
+ const binaryData = await this.client.apiRequestBinary("typeToTypeNode", {
852
+ snapshot: this.snapshotId,
853
+ project: this.projectId,
854
+ type: type.id,
855
+ location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined,
856
+ flags,
857
+ });
858
+ if (!binaryData)
859
+ return undefined;
860
+ return decodeNode(binaryData);
861
+ }
862
+ async signatureToSignatureDeclaration(signature, kind, enclosingDeclaration, flags) {
863
+ const binaryData = await this.client.apiRequestBinary("signatureToSignatureDeclaration", {
864
+ snapshot: this.snapshotId,
865
+ project: this.projectId,
866
+ signature: signature.id,
867
+ kind,
868
+ location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined,
869
+ flags,
870
+ });
871
+ if (!binaryData)
872
+ return undefined;
873
+ return decodeNode(binaryData);
874
+ }
875
+ async typeToString(type, enclosingDeclaration, flags) {
876
+ return this.client.apiRequest("typeToString", {
877
+ snapshot: this.snapshotId,
878
+ project: this.projectId,
879
+ type: type.id,
880
+ location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined,
881
+ flags,
882
+ });
883
+ }
884
+ async isContextSensitive(node) {
885
+ return this.client.apiRequest("isContextSensitive", {
886
+ snapshot: this.snapshotId,
887
+ project: this.projectId,
888
+ location: getNodeId(node),
889
+ });
890
+ }
891
+ async isArrayType(type) {
892
+ return this.client.apiRequest("isArrayType", {
893
+ snapshot: this.snapshotId,
894
+ project: this.projectId,
895
+ type: type.id,
896
+ });
897
+ }
898
+ async isTupleType(type) {
899
+ return this.client.apiRequest("isTupleType", {
900
+ snapshot: this.snapshotId,
901
+ project: this.projectId,
902
+ type: type.id,
903
+ });
904
+ }
905
+ async getReturnTypeOfSignature(signature) {
906
+ const data = await this.client.apiRequest("getReturnTypeOfSignature", {
907
+ snapshot: this.snapshotId,
908
+ project: this.projectId,
909
+ signature: signature.id,
910
+ });
911
+ return data ? this.objectRegistry.getOrCreateType(data) : undefined;
912
+ }
913
+ async getRestTypeOfSignature(signature) {
914
+ const data = await this.client.apiRequest("getRestTypeOfSignature", {
915
+ snapshot: this.snapshotId,
916
+ project: this.projectId,
917
+ signature: signature.id,
918
+ });
919
+ return data ? this.objectRegistry.getOrCreateType(data) : undefined;
920
+ }
921
+ async getTypePredicateOfSignature(signature) {
922
+ const data = await this.client.apiRequest("getTypePredicateOfSignature", {
923
+ snapshot: this.snapshotId,
924
+ project: this.projectId,
925
+ signature: signature.id,
926
+ });
927
+ if (!data)
928
+ return undefined;
929
+ return {
930
+ kind: data.kind,
931
+ parameterIndex: data.parameterIndex,
932
+ parameterName: data.parameterName,
933
+ type: data.type ? this.objectRegistry.getOrCreateType(data.type) : undefined,
934
+ };
935
+ }
936
+ /**
937
+ * Get the base types of a class or interface type. A type with no base types
938
+ * yields an empty array.
939
+ */
940
+ async getBaseTypes(type) {
941
+ const data = await this.client.apiRequest("getBaseTypes", {
942
+ snapshot: this.snapshotId,
943
+ project: this.projectId,
944
+ type: type.id,
945
+ });
946
+ return data ? data.map(d => this.objectRegistry.getOrCreateType(d)) : [];
947
+ }
948
+ async getApparentType(type) {
949
+ const data = await this.client.apiRequest("getApparentType", {
950
+ snapshot: this.snapshotId,
951
+ project: this.projectId,
952
+ type: type.id,
953
+ });
954
+ return data ? this.objectRegistry.getOrCreateType(data) : undefined;
955
+ }
956
+ async getPropertiesOfType(type) {
957
+ const data = await this.client.apiRequest("getPropertiesOfType", {
958
+ snapshot: this.snapshotId,
959
+ project: this.projectId,
960
+ type: type.id,
961
+ });
962
+ return data ? data.map(d => this.objectRegistry.getOrCreateSymbol(d)) : [];
963
+ }
964
+ async getIndexInfosOfType(type) {
965
+ const data = await this.client.apiRequest("getIndexInfosOfType", {
966
+ snapshot: this.snapshotId,
967
+ project: this.projectId,
968
+ type: type.id,
969
+ });
970
+ if (!data)
971
+ return [];
972
+ return data.map(d => ({
973
+ keyType: this.objectRegistry.getOrCreateType(d.keyType),
974
+ valueType: this.objectRegistry.getOrCreateType(d.valueType),
975
+ isReadonly: d.isReadonly ?? false,
976
+ declaration: d.declaration ? new NodeHandle(d.declaration) : undefined,
977
+ }));
978
+ }
979
+ /**
980
+ * Get the constraint of a type parameter (the `T` in `<U extends T>`), or
981
+ * undefined if it has none.
982
+ */
983
+ async getConstraintOfTypeParameter(type) {
984
+ const data = await this.client.apiRequest("getConstraintOfTypeParameter", {
985
+ snapshot: this.snapshotId,
986
+ project: this.projectId,
987
+ type: type.id,
988
+ });
989
+ return data ? this.objectRegistry.getOrCreateType(data) : undefined;
990
+ }
991
+ async getBaseConstraintOfType(type) {
992
+ const data = await this.client.apiRequest("getBaseConstraintOfType", {
993
+ snapshot: this.snapshotId,
994
+ project: this.projectId,
995
+ type: type.id,
996
+ });
997
+ return data ? this.objectRegistry.getOrCreateType(data) : undefined;
998
+ }
999
+ async getPropertyOfType(type, name) {
1000
+ const data = await this.client.apiRequest("getPropertyOfType", {
1001
+ snapshot: this.snapshotId,
1002
+ project: this.projectId,
1003
+ type: type.id,
1004
+ name,
1005
+ });
1006
+ return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
1007
+ }
1008
+ async getConstantValue(node) {
1009
+ const data = await this.client.apiRequest("getConstantValue", {
1010
+ snapshot: this.snapshotId,
1011
+ project: this.projectId,
1012
+ location: getNodeId(node),
1013
+ });
1014
+ return data ?? undefined;
1015
+ }
1016
+ async getSignatureFromDeclaration(node) {
1017
+ const data = await this.client.apiRequest("getSignatureFromDeclaration", {
1018
+ snapshot: this.snapshotId,
1019
+ project: this.projectId,
1020
+ location: getNodeId(node),
1021
+ });
1022
+ return data ? this.objectRegistry.getOrCreateSignature(data) : undefined;
1023
+ }
1024
+ async getExportSpecifierLocalTargetSymbol(node) {
1025
+ const data = await this.client.apiRequest("getExportSpecifierLocalTargetSymbol", {
1026
+ snapshot: this.snapshotId,
1027
+ project: this.projectId,
1028
+ location: getNodeId(node),
1029
+ });
1030
+ return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
1031
+ }
1032
+ async getAliasedSymbol(symbol) {
1033
+ const data = await this.client.apiRequest("getAliasedSymbol", {
1034
+ snapshot: this.snapshotId,
1035
+ project: this.projectId,
1036
+ symbol: symbol.id,
1037
+ });
1038
+ return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
1039
+ }
1040
+ async getImmediateAliasedSymbol(symbol) {
1041
+ const data = await this.client.apiRequest("getImmediateAliasedSymbol", {
1042
+ snapshot: this.snapshotId,
1043
+ project: this.projectId,
1044
+ symbol: symbol.id,
1045
+ });
1046
+ return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
1047
+ }
1048
+ async getExportsOfModule(symbol) {
1049
+ const data = await this.client.apiRequest("getExportsOfModule", {
1050
+ snapshot: this.snapshotId,
1051
+ project: this.projectId,
1052
+ symbol: symbol.id,
1053
+ });
1054
+ return data ? data.map(d => this.objectRegistry.getOrCreateSymbol(d)) : [];
1055
+ }
1056
+ async getMemberInModuleExports(symbol, name) {
1057
+ const data = await this.client.apiRequest("getMemberInModuleExports", {
1058
+ snapshot: this.snapshotId,
1059
+ project: this.projectId,
1060
+ symbol: symbol.id,
1061
+ name,
1062
+ });
1063
+ return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
1064
+ }
1065
+ async getJsDocTagsOfSymbol(symbol) {
1066
+ const data = await this.client.apiRequest("getJsDocTags", {
1067
+ snapshot: this.snapshotId,
1068
+ project: this.projectId,
1069
+ symbol: symbol.id,
1070
+ });
1071
+ return data ?? [];
1072
+ }
1073
+ async getDocumentationCommentOfSymbol(symbol) {
1074
+ return this.client.apiRequest("getDocumentationComment", {
1075
+ snapshot: this.snapshotId,
1076
+ project: this.projectId,
1077
+ symbol: symbol.id,
1078
+ });
1079
+ }
1080
+ /**
1081
+ * Get the type arguments of a type reference (e.g. the `string` in `Array<string>`).
1082
+ */
1083
+ async getTypeArguments(type) {
1084
+ const data = await this.client.apiRequest("getTypeArguments", {
1085
+ snapshot: this.snapshotId,
1086
+ project: this.projectId,
1087
+ type: type.id,
1088
+ });
1089
+ return data ? data.map(d => this.objectRegistry.getOrCreateType(d)) : [];
1090
+ }
1091
+ }
1092
+ export class Emitter {
1093
+ client;
1094
+ constructor(client) {
1095
+ this.client = client;
1096
+ }
1097
+ async printNode(node, options = {}) {
1098
+ const encoded = encodeNode(node);
1099
+ const base64 = uint8ArrayToBase64(encoded);
1100
+ return this.client.apiRequest("printNode", {
1101
+ data: base64,
1102
+ ...options,
1103
+ });
1104
+ }
1105
+ }
1106
+ export class NodeHandle {
1107
+ index;
1108
+ kind;
1109
+ path;
1110
+ constructor(handle) {
1111
+ const parsed = parseNodeHandle(handle);
1112
+ this.index = parsed.index;
1113
+ this.kind = parsed.kind;
1114
+ this.path = parsed.path;
1115
+ }
1116
+ /**
1117
+ * Resolve this handle to the actual AST node by fetching the source file
1118
+ * from the given project and looking up the node by index.
1119
+ */
1120
+ async resolve(project) {
1121
+ const sourceFile = await project.program.getSourceFile(this.path);
1122
+ if (!sourceFile) {
1123
+ return undefined;
1124
+ }
1125
+ return sourceFile.getOrCreateNodeAtIndex(this.index);
1126
+ }
1127
+ }
1128
+ export class Symbol {
1129
+ objectRegistry;
1130
+ id;
1131
+ name;
1132
+ flags;
1133
+ checkFlags;
1134
+ declarations;
1135
+ valueDeclaration;
1136
+ parent;
1137
+ exportSymbol;
1138
+ constructor(data, objectRegistry) {
1139
+ this.objectRegistry = objectRegistry;
1140
+ this.id = data.id;
1141
+ this.name = data.name;
1142
+ this.flags = data.flags;
1143
+ this.checkFlags = data.checkFlags;
1144
+ this.declarations = (data.declarations ?? []).map(d => new NodeHandle(d));
1145
+ this.valueDeclaration = data.valueDeclaration ? new NodeHandle(data.valueDeclaration) : undefined;
1146
+ if (data.parent !== undefined)
1147
+ this.parent = data.parent;
1148
+ if (data.exportSymbol !== undefined)
1149
+ this.exportSymbol = data.exportSymbol;
1150
+ }
1151
+ async getParent() {
1152
+ return this.objectRegistry.fetchSymbol(this, "getParentOfSymbol", this.parent);
1153
+ }
1154
+ async getMembers() {
1155
+ return this.objectRegistry.fetchSymbols(this, "getMembersOfSymbol");
1156
+ }
1157
+ async getExports() {
1158
+ return this.objectRegistry.fetchSymbols(this, "getExportsOfSymbol");
1159
+ }
1160
+ async getExportSymbol() {
1161
+ if (!this.exportSymbol)
1162
+ return this;
1163
+ return this.objectRegistry.fetchSymbol(this, "getExportSymbolOfSymbol", this.exportSymbol);
1164
+ }
1165
+ async getJsDocTags(checker) {
1166
+ return checker.getJsDocTagsOfSymbol(this);
1167
+ }
1168
+ async getDocumentationComment(checker) {
1169
+ return checker.getDocumentationCommentOfSymbol(this);
1170
+ }
1171
+ }
1172
+ class TypeObject {
1173
+ objectRegistry;
1174
+ id;
1175
+ flags;
1176
+ objectFlags;
1177
+ symbol;
1178
+ value;
1179
+ intrinsicName;
1180
+ isThisType;
1181
+ freshType;
1182
+ regularType;
1183
+ target;
1184
+ typeParameters;
1185
+ outerTypeParameters;
1186
+ localTypeParameters;
1187
+ aliasTypeArguments;
1188
+ aliasSymbol;
1189
+ elementFlags;
1190
+ fixedLength;
1191
+ readonly;
1192
+ texts;
1193
+ objectType;
1194
+ indexType;
1195
+ checkType;
1196
+ extendsType;
1197
+ baseType;
1198
+ substConstraint;
1199
+ trueType; // false if not yet loaded
1200
+ falseType; // false if not yet loaded
1201
+ constructor(data, objectRegistry) {
1202
+ this.objectRegistry = objectRegistry;
1203
+ this.id = data.id;
1204
+ this.flags = data.flags;
1205
+ if (data.objectFlags !== undefined)
1206
+ this.objectFlags = data.objectFlags;
1207
+ if (data.symbol !== undefined)
1208
+ this.symbol = data.symbol;
1209
+ if (data.value != null) {
1210
+ // BigInt literal values are serialized as decimal strings (e.g. "-123") because
1211
+ // JSON cannot represent bigint. Decode them back into a real bigint here.
1212
+ this.value = (data.flags & TypeFlags.BigIntLiteral) ? BigInt(data.value) : data.value;
1213
+ }
1214
+ if (data.intrinsicName !== undefined)
1215
+ this.intrinsicName = data.intrinsicName;
1216
+ if (data.isThisType !== undefined)
1217
+ this.isThisType = data.isThisType;
1218
+ if (data.freshType !== undefined)
1219
+ this.freshType = data.freshType;
1220
+ if (data.regularType !== undefined)
1221
+ this.regularType = data.regularType;
1222
+ if (data.target !== undefined)
1223
+ this.target = data.target;
1224
+ this.typeParameters = data.typeParameters ?? [];
1225
+ this.outerTypeParameters = data.outerTypeParameters ?? [];
1226
+ this.localTypeParameters = data.localTypeParameters ?? [];
1227
+ this.aliasTypeArguments = data.aliasTypeArguments ?? [];
1228
+ if (data.aliasSymbol !== undefined)
1229
+ this.aliasSymbol = data.aliasSymbol;
1230
+ if (data.elementFlags !== undefined)
1231
+ this.elementFlags = data.elementFlags;
1232
+ if (data.fixedLength !== undefined)
1233
+ this.fixedLength = data.fixedLength;
1234
+ if (data.readonly !== undefined)
1235
+ this.readonly = data.readonly;
1236
+ if (data.texts !== undefined)
1237
+ this.texts = data.texts;
1238
+ if (data.objectType !== undefined)
1239
+ this.objectType = data.objectType;
1240
+ if (data.indexType !== undefined)
1241
+ this.indexType = data.indexType;
1242
+ if (data.checkType !== undefined)
1243
+ this.checkType = data.checkType;
1244
+ if (data.extendsType !== undefined)
1245
+ this.extendsType = data.extendsType;
1246
+ if (data.baseType !== undefined)
1247
+ this.baseType = data.baseType;
1248
+ if (data.substConstraint !== undefined)
1249
+ this.substConstraint = data.substConstraint;
1250
+ this.trueType = false;
1251
+ this.falseType = false;
1252
+ }
1253
+ async getSymbol() {
1254
+ return this.objectRegistry.fetchSymbol(this, "getSymbolOfType", this.symbol);
1255
+ }
1256
+ async getAliasSymbol() {
1257
+ return this.objectRegistry.fetchSymbol(this, "getAliasSymbolOfType", this.aliasSymbol);
1258
+ }
1259
+ async getTarget() {
1260
+ return this.objectRegistry.fetchType(this, "getTargetOfType", this.target);
1261
+ }
1262
+ async getFreshType() {
1263
+ return this.objectRegistry.fetchType(this, "getFreshTypeOfType", this.freshType);
1264
+ }
1265
+ async getRegularType() {
1266
+ return this.objectRegistry.fetchType(this, "getRegularTypeOfType", this.regularType);
1267
+ }
1268
+ async getTypes() {
1269
+ // Only union, intersection, and template literal types have constituent
1270
+ // types; any other kind has none, so return undefined rather than sending
1271
+ // a request the server cannot satisfy.
1272
+ if (!(this.flags & (TypeFlags.UnionOrIntersection | TypeFlags.TemplateLiteral))) {
1273
+ return undefined;
1274
+ }
1275
+ return this.objectRegistry.fetchTypes(this, "getTypesOfType");
1276
+ }
1277
+ async getTypeParameters() {
1278
+ return this.objectRegistry.fetchTypes(this, "getTypeParametersOfType", this.typeParameters);
1279
+ }
1280
+ async getOuterTypeParameters() {
1281
+ return this.objectRegistry.fetchTypes(this, "getOuterTypeParametersOfType", this.outerTypeParameters);
1282
+ }
1283
+ async getLocalTypeParameters() {
1284
+ return this.objectRegistry.fetchTypes(this, "getLocalTypeParametersOfType", this.localTypeParameters);
1285
+ }
1286
+ async getAliasTypeArguments() {
1287
+ return this.objectRegistry.fetchTypes(this, "getAliasTypeArgumentsOfType", this.aliasTypeArguments);
1288
+ }
1289
+ async getObjectType() {
1290
+ return this.objectRegistry.fetchType(this, "getObjectTypeOfType", this.objectType);
1291
+ }
1292
+ async getIndexType() {
1293
+ return this.objectRegistry.fetchType(this, "getIndexTypeOfType", this.indexType);
1294
+ }
1295
+ async getCheckType() {
1296
+ return this.objectRegistry.fetchType(this, "getCheckTypeOfType", this.checkType);
1297
+ }
1298
+ async getExtendsType() {
1299
+ return this.objectRegistry.fetchType(this, "getExtendsTypeOfType", this.extendsType);
1300
+ }
1301
+ async getBaseType() {
1302
+ return this.objectRegistry.fetchType(this, "getBaseTypeOfType", this.baseType);
1303
+ }
1304
+ async getConstraint() {
1305
+ return this.objectRegistry.fetchType(this, "getConstraintOfType", this.substConstraint);
1306
+ }
1307
+ async getTrueType() {
1308
+ const result = await this.objectRegistry.fetchType(this, "getTrueTypeOfConditionalType", this.trueType);
1309
+ this.trueType = result.id;
1310
+ return result;
1311
+ }
1312
+ async getFalseType() {
1313
+ const result = await this.objectRegistry.fetchType(this, "getFalseTypeOfConditionalType", this.falseType);
1314
+ this.falseType = result.id;
1315
+ return result;
1316
+ }
1317
+ isUnionType() {
1318
+ return isUnionType(this);
1319
+ }
1320
+ isIntersectionType() {
1321
+ return isIntersectionType(this);
1322
+ }
1323
+ isObjectType() {
1324
+ return isObjectType(this);
1325
+ }
1326
+ isIntrinsicType() {
1327
+ return isIntrinsicType(this);
1328
+ }
1329
+ isLiteralType() {
1330
+ return isLiteralType(this);
1331
+ }
1332
+ isStringLiteralType() {
1333
+ return isStringLiteralType(this);
1334
+ }
1335
+ isNumberLiteralType() {
1336
+ return isNumberLiteralType(this);
1337
+ }
1338
+ isBigIntLiteralType() {
1339
+ return isBigIntLiteralType(this);
1340
+ }
1341
+ isBooleanLiteralType() {
1342
+ return isBooleanLiteralType(this);
1343
+ }
1344
+ isTypeReference() {
1345
+ return isTypeReference(this);
1346
+ }
1347
+ isTupleType() {
1348
+ return isTupleType(this);
1349
+ }
1350
+ isIndexType() {
1351
+ return isIndexType(this);
1352
+ }
1353
+ isIndexedAccessType() {
1354
+ return isIndexedAccessType(this);
1355
+ }
1356
+ isConditionalType() {
1357
+ return isConditionalType(this);
1358
+ }
1359
+ isSubstitutionType() {
1360
+ return isSubstitutionType(this);
1361
+ }
1362
+ isTemplateLiteralType() {
1363
+ return isTemplateLiteralType(this);
1364
+ }
1365
+ isStringMappingType() {
1366
+ return isStringMappingType(this);
1367
+ }
1368
+ isTypeParameter() {
1369
+ return isTypeParameter(this);
1370
+ }
1371
+ }
1372
+ export function isUnionType(type) {
1373
+ return (type.flags & TypeFlags.Union) !== 0;
1374
+ }
1375
+ export function isIntersectionType(type) {
1376
+ return (type.flags & TypeFlags.Intersection) !== 0;
1377
+ }
1378
+ export function isObjectType(type) {
1379
+ return (type.flags & TypeFlags.Object) !== 0;
1380
+ }
1381
+ export function isIntrinsicType(type) {
1382
+ return (type.flags & TypeFlags.Intrinsic) !== 0;
1383
+ }
1384
+ export function isLiteralType(type) {
1385
+ return (type.flags & TypeFlags.Literal) !== 0;
1386
+ }
1387
+ export function isStringLiteralType(type) {
1388
+ return (type.flags & TypeFlags.StringLiteral) !== 0;
1389
+ }
1390
+ export function isNumberLiteralType(type) {
1391
+ return (type.flags & TypeFlags.NumberLiteral) !== 0;
1392
+ }
1393
+ export function isBigIntLiteralType(type) {
1394
+ return (type.flags & TypeFlags.BigIntLiteral) !== 0;
1395
+ }
1396
+ export function isBooleanLiteralType(type) {
1397
+ return (type.flags & TypeFlags.BooleanLiteral) !== 0;
1398
+ }
1399
+ export function isTypeReference(type) {
1400
+ return isObjectType(type) && (type.objectFlags & ObjectFlags.Reference) !== 0;
1401
+ }
1402
+ export function isTupleType(type) {
1403
+ return isObjectType(type) && (type.objectFlags & ObjectFlags.Tuple) !== 0;
1404
+ }
1405
+ export function isIndexType(type) {
1406
+ return (type.flags & TypeFlags.Index) !== 0;
1407
+ }
1408
+ export function isIndexedAccessType(type) {
1409
+ return (type.flags & TypeFlags.IndexedAccess) !== 0;
1410
+ }
1411
+ export function isConditionalType(type) {
1412
+ return (type.flags & TypeFlags.Conditional) !== 0;
1413
+ }
1414
+ export function isSubstitutionType(type) {
1415
+ return (type.flags & TypeFlags.Substitution) !== 0;
1416
+ }
1417
+ export function isTemplateLiteralType(type) {
1418
+ return (type.flags & TypeFlags.TemplateLiteral) !== 0;
1419
+ }
1420
+ export function isStringMappingType(type) {
1421
+ return (type.flags & TypeFlags.StringMapping) !== 0;
1422
+ }
1423
+ export function isTypeParameter(type) {
1424
+ return (type.flags & TypeFlags.TypeParameter) !== 0;
1425
+ }
1426
+ export class Signature {
1427
+ flags;
1428
+ objectRegistry;
1429
+ id;
1430
+ declaration;
1431
+ typeParameters;
1432
+ parameters;
1433
+ thisParameter;
1434
+ target;
1435
+ constructor(data, objectRegistry) {
1436
+ this.id = data.id;
1437
+ this.flags = data.flags;
1438
+ this.objectRegistry = objectRegistry;
1439
+ this.declaration = data.declaration ? new NodeHandle(data.declaration) : undefined;
1440
+ this.typeParameters = data.typeParameters ?? [];
1441
+ this.parameters = data.parameters ?? [];
1442
+ this.thisParameter = data.thisParameter;
1443
+ this.target = data.target;
1444
+ }
1445
+ async getTypeParameters() {
1446
+ return this.objectRegistry.fetchTypes(this, "getTypeParametersOfSignature", this.typeParameters);
1447
+ }
1448
+ async getParameters() {
1449
+ return this.objectRegistry.fetchSymbols(this, "getParametersOfSignature", this.parameters);
1450
+ }
1451
+ async getThisParameter() {
1452
+ return this.objectRegistry.fetchSymbol(this, "getThisParameterOfSignature", this.thisParameter);
1453
+ }
1454
+ async getTarget() {
1455
+ return this.objectRegistry.fetchSignature(this, "getTargetOfSignature", this.target);
1456
+ }
1457
+ get hasRestParameter() {
1458
+ return (this.flags & SignatureFlags.HasRestParameter) !== 0;
1459
+ }
1460
+ get isConstruct() {
1461
+ return (this.flags & SignatureFlags.Construct) !== 0;
1462
+ }
1463
+ get isAbstract() {
1464
+ return (this.flags & SignatureFlags.Abstract) !== 0;
1465
+ }
1466
+ }
1467
+ //# sourceMappingURL=api.js.map