typescript 7.0.1-rc → 7.0.2

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 (158) hide show
  1. package/NOTICE.txt +1 -1
  2. package/README.md +39 -14
  3. package/dist/api/async/api.d.ts +274 -45
  4. package/dist/api/async/api.d.ts.map +1 -1
  5. package/dist/api/async/api.js +722 -137
  6. package/dist/api/async/api.js.map +1 -1
  7. package/dist/api/async/client.d.ts +17 -0
  8. package/dist/api/async/client.d.ts.map +1 -1
  9. package/dist/api/async/client.js +72 -1
  10. package/dist/api/async/client.js.map +1 -1
  11. package/dist/api/async/types.d.ts +108 -27
  12. package/dist/api/async/types.d.ts.map +1 -1
  13. package/dist/api/compilerOptions.d.ts +109 -0
  14. package/dist/api/compilerOptions.d.ts.map +1 -0
  15. package/dist/api/compilerOptions.js +2 -0
  16. package/dist/api/compilerOptions.js.map +1 -0
  17. package/dist/api/node/encoder.d.ts.map +1 -1
  18. package/dist/api/node/encoder.js +1 -18
  19. package/dist/api/node/encoder.js.map +1 -1
  20. package/dist/api/node/msgpack.d.ts.map +1 -1
  21. package/dist/api/node/msgpack.js +2 -1
  22. package/dist/api/node/msgpack.js.map +1 -1
  23. package/dist/api/node/node.d.ts +17 -3
  24. package/dist/api/node/node.d.ts.map +1 -1
  25. package/dist/api/node/node.generated.d.ts +11 -0
  26. package/dist/api/node/node.generated.d.ts.map +1 -1
  27. package/dist/api/node/node.generated.js +69 -48
  28. package/dist/api/node/node.generated.js.map +1 -1
  29. package/dist/api/node/node.infrastructure.d.ts +11 -0
  30. package/dist/api/node/node.infrastructure.d.ts.map +1 -1
  31. package/dist/api/node/node.infrastructure.js.map +1 -1
  32. package/dist/api/node/node.js +93 -9
  33. package/dist/api/node/node.js.map +1 -1
  34. package/dist/api/node/wtf8.d.ts +6 -0
  35. package/dist/api/node/wtf8.d.ts.map +1 -0
  36. package/dist/api/node/wtf8.js +61 -0
  37. package/dist/api/node/wtf8.js.map +1 -0
  38. package/dist/api/options.d.ts +8 -0
  39. package/dist/api/options.d.ts.map +1 -1
  40. package/dist/api/options.js.map +1 -1
  41. package/dist/api/proto.d.ts +58 -5
  42. package/dist/api/proto.d.ts.map +1 -1
  43. package/dist/api/proto.js +15 -0
  44. package/dist/api/proto.js.map +1 -1
  45. package/dist/api/sync/api.d.ts +274 -45
  46. package/dist/api/sync/api.d.ts.map +1 -1
  47. package/dist/api/sync/api.js +720 -135
  48. package/dist/api/sync/api.js.map +1 -1
  49. package/dist/api/sync/client.d.ts +17 -0
  50. package/dist/api/sync/client.d.ts.map +1 -1
  51. package/dist/api/sync/client.js +53 -1
  52. package/dist/api/sync/client.js.map +1 -1
  53. package/dist/api/sync/types.d.ts +108 -27
  54. package/dist/api/sync/types.d.ts.map +1 -1
  55. package/dist/api/syncChannel.d.ts +4 -1
  56. package/dist/api/syncChannel.d.ts.map +1 -1
  57. package/dist/api/syncChannel.js +21 -1
  58. package/dist/api/syncChannel.js.map +1 -1
  59. package/dist/api/timing.d.ts +175 -0
  60. package/dist/api/timing.d.ts.map +1 -0
  61. package/dist/api/timing.js +149 -0
  62. package/dist/api/timing.js.map +1 -0
  63. package/dist/ast/ast.d.ts +36 -2
  64. package/dist/ast/ast.d.ts.map +1 -1
  65. package/dist/ast/ast.generated.d.ts +3 -3
  66. package/dist/ast/ast.generated.d.ts.map +1 -1
  67. package/dist/ast/ast.js.map +1 -1
  68. package/dist/ast/factory.generated.d.ts +12 -4
  69. package/dist/ast/factory.generated.d.ts.map +1 -1
  70. package/dist/ast/factory.generated.js +36 -2
  71. package/dist/ast/factory.generated.js.map +1 -1
  72. package/dist/ast/index.d.ts +2 -0
  73. package/dist/ast/index.d.ts.map +1 -1
  74. package/dist/ast/index.js +2 -0
  75. package/dist/ast/index.js.map +1 -1
  76. package/dist/ast/is.d.ts +2 -1
  77. package/dist/ast/is.d.ts.map +1 -1
  78. package/dist/ast/is.generated.d.ts +2 -2
  79. package/dist/ast/is.generated.d.ts.map +1 -1
  80. package/dist/ast/is.generated.js +3 -4
  81. package/dist/ast/is.generated.js.map +1 -1
  82. package/dist/ast/is.js +8 -1
  83. package/dist/ast/is.js.map +1 -1
  84. package/dist/ast/jsdoc.d.ts +11 -0
  85. package/dist/ast/jsdoc.d.ts.map +1 -0
  86. package/dist/ast/jsdoc.js +202 -0
  87. package/dist/ast/jsdoc.js.map +1 -0
  88. package/dist/ast/utils.d.ts +12 -0
  89. package/dist/ast/utils.d.ts.map +1 -1
  90. package/dist/ast/utils.js +40 -0
  91. package/dist/ast/utils.js.map +1 -1
  92. package/dist/enums/internalSymbolName.d.ts +2 -0
  93. package/dist/enums/internalSymbolName.d.ts.map +1 -0
  94. package/dist/enums/internalSymbolName.enum.d.ts +23 -0
  95. package/dist/enums/internalSymbolName.enum.d.ts.map +1 -0
  96. package/dist/enums/internalSymbolName.enum.js +25 -0
  97. package/dist/enums/internalSymbolName.enum.js.map +1 -0
  98. package/dist/enums/internalSymbolName.js +25 -0
  99. package/dist/enums/internalSymbolName.js.map +1 -0
  100. package/dist/enums/jsxEmit.d.ts +2 -0
  101. package/dist/enums/jsxEmit.d.ts.map +1 -0
  102. package/dist/enums/jsxEmit.enum.d.ts +9 -0
  103. package/dist/enums/jsxEmit.enum.d.ts.map +1 -0
  104. package/dist/enums/jsxEmit.enum.js +11 -0
  105. package/dist/enums/jsxEmit.enum.js.map +1 -0
  106. package/dist/enums/jsxEmit.js +11 -0
  107. package/dist/enums/jsxEmit.js.map +1 -0
  108. package/dist/enums/moduleDetectionKind.d.ts +2 -0
  109. package/dist/enums/moduleDetectionKind.d.ts.map +1 -0
  110. package/dist/enums/moduleDetectionKind.enum.d.ts +7 -0
  111. package/dist/enums/moduleDetectionKind.enum.d.ts.map +1 -0
  112. package/dist/enums/moduleDetectionKind.enum.js +9 -0
  113. package/dist/enums/moduleDetectionKind.enum.js.map +1 -0
  114. package/dist/enums/moduleDetectionKind.js +9 -0
  115. package/dist/enums/moduleDetectionKind.js.map +1 -0
  116. package/dist/enums/moduleKind.d.ts +2 -0
  117. package/dist/enums/moduleKind.d.ts.map +1 -0
  118. package/dist/enums/moduleKind.enum.d.ts +17 -0
  119. package/dist/enums/moduleKind.enum.d.ts.map +1 -0
  120. package/dist/enums/moduleKind.enum.js +19 -0
  121. package/dist/enums/moduleKind.enum.js.map +1 -0
  122. package/dist/enums/moduleKind.js +19 -0
  123. package/dist/enums/moduleKind.js.map +1 -0
  124. package/dist/enums/moduleResolutionKind.d.ts +2 -0
  125. package/dist/enums/moduleResolutionKind.d.ts.map +1 -0
  126. package/dist/enums/moduleResolutionKind.enum.d.ts +9 -0
  127. package/dist/enums/moduleResolutionKind.enum.d.ts.map +1 -0
  128. package/dist/enums/moduleResolutionKind.enum.js +11 -0
  129. package/dist/enums/moduleResolutionKind.enum.js.map +1 -0
  130. package/dist/enums/moduleResolutionKind.js +11 -0
  131. package/dist/enums/moduleResolutionKind.js.map +1 -0
  132. package/dist/enums/newLineKind.d.ts +2 -0
  133. package/dist/enums/newLineKind.d.ts.map +1 -0
  134. package/dist/enums/newLineKind.enum.d.ts +6 -0
  135. package/dist/enums/newLineKind.enum.d.ts.map +1 -0
  136. package/dist/enums/newLineKind.enum.js +8 -0
  137. package/dist/enums/newLineKind.enum.js.map +1 -0
  138. package/dist/enums/newLineKind.js +8 -0
  139. package/dist/enums/newLineKind.js.map +1 -0
  140. package/dist/enums/outerExpressionKinds.enum.d.ts +5 -1
  141. package/dist/enums/outerExpressionKinds.enum.d.ts.map +1 -1
  142. package/dist/enums/outerExpressionKinds.enum.js +4 -0
  143. package/dist/enums/outerExpressionKinds.enum.js.map +1 -1
  144. package/dist/enums/outerExpressionKinds.js +4 -0
  145. package/dist/enums/outerExpressionKinds.js.map +1 -1
  146. package/dist/internal/utils.d.ts +23 -0
  147. package/dist/internal/utils.d.ts.map +1 -0
  148. package/dist/internal/utils.js +25 -0
  149. package/dist/internal/utils.js.map +1 -0
  150. package/lib/getExePath.js +6 -3
  151. package/lib/tsc.js +1 -1
  152. package/lib/version.cjs +3 -0
  153. package/lib/version.d.cts +2 -0
  154. package/package.json +31 -30
  155. package/dist/api/objectRegistry.d.ts +0 -40
  156. package/dist/api/objectRegistry.d.ts.map +0 -1
  157. package/dist/api/objectRegistry.js +0 -61
  158. package/dist/api/objectRegistry.js.map +0 -1
package/NOTICE.txt CHANGED
@@ -221,7 +221,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
221
221
 
222
222
  ---------------------------------------------------------
223
223
 
224
- github.com/go-json-experiment/json v0.0.0-20260601182631-00ed12fed2a6 - BSD-3-Clause
224
+ github.com/go-json-experiment/json v0.0.0-20260623181947-01eb4420fa68 - BSD-3-Clause
225
225
 
226
226
 
227
227
  Copyright 2010 The Go Authors
package/README.md CHANGED
@@ -1,24 +1,49 @@
1
- # TypeScript (Native Preview)
1
+ # TypeScript
2
2
 
3
- This package provides a preview build of [the native port of TypeScript](https://devblogs.microsoft.com/typescript/typescript-native-port/).
4
- Not all features are implemented yet.
3
+ [![CI](https://github.com/microsoft/TypeScript/actions/workflows/ci.yml/badge.svg)](https://github.com/microsoft/TypeScript/actions/workflows/ci.yml)
4
+ [![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript)
5
+ [![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript)
6
+ [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/microsoft/TypeScript/badge)](https://securityscorecards.dev/viewer/?uri=github.com/microsoft/TypeScript)
5
7
 
6
- This package is intended for testing and experimentation.
7
- It will eventually be replaced by the official TypeScript package.
8
+ [TypeScript](https://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types to JavaScript that support tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](https://www.typescriptlang.org/play/), and stay up to date via [our blog](https://devblogs.microsoft.com/typescript/) and [Bluesky](https://bsky.app/profile/typescriptlang.org).
8
9
 
9
- ## Usage
10
+ Find others who are using TypeScript at [our community page](https://www.typescriptlang.org/community/).
10
11
 
11
- For TypeScript 7.0 RC and later, use `tsc` just like for TypeScript 6.0.
12
+ ## Installing
12
13
 
13
- For other builds, use the `tsgo` command just like you would use `tsc`:
14
+ For the latest stable version:
14
15
 
15
- ```sh
16
- npx tsgo --help
16
+ ```bash
17
+ npm install -D typescript
17
18
  ```
18
19
 
19
- ## Issues and Feedback
20
+ For our nightly builds:
20
21
 
21
- The native port of TypeScript is still in progress.
22
- We expect many gaps, but are seeking experimentation and feedback.
23
- If you have found differences that are not yet known, we encourage you to leave feedback on [the issue tracker](https://github.com/microsoft/typescript-go/issues).
22
+ ```bash
23
+ npm install -D typescript@next
24
+ ```
25
+
26
+ ## Contribute
27
+
28
+ There are many ways to [contribute](https://github.com/microsoft/TypeScript/blob/main/CONTRIBUTING.md) to TypeScript.
29
+
30
+ * [Submit bugs](https://github.com/microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
31
+ * Review the [source code changes](https://github.com/microsoft/TypeScript/pulls).
32
+ * Engage with other TypeScript users and developers on [Stack Overflow](https://stackoverflow.com/questions/tagged/typescript).
33
+ * Help each other in the [TypeScript Community Discord](https://discord.gg/typescript).
34
+ * Join the [#typescript](https://bsky.app/search?q=%23typescript) discussion on Bluesky.
35
+ * [Contribute bug fixes](https://github.com/microsoft/TypeScript/blob/main/CONTRIBUTING.md).
36
+
37
+ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see
38
+ the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com)
39
+ with any additional questions or comments.
40
+
41
+ ## Documentation
42
+
43
+ * [TypeScript in 5 minutes](https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html)
44
+ * [Programming handbook](https://www.typescriptlang.org/docs/handbook/intro.html)
45
+ * [Homepage](https://www.typescriptlang.org/)
46
+
47
+ ## Roadmap
24
48
 
49
+ For details on our planned features and future direction, please refer to our [roadmap](https://github.com/microsoft/TypeScript/wiki/Roadmap).
@@ -2,6 +2,7 @@
2
2
  import { CompletionItemKind } from "#enums/completionItemKind";
3
3
  import { DiagnosticCategory } from "#enums/diagnosticCategory";
4
4
  import { ElementFlags } from "#enums/elementFlags";
5
+ import { ModuleKind } from "#enums/moduleKind";
5
6
  import { NodeBuilderFlags } from "#enums/nodeBuilderFlags";
6
7
  import { ObjectFlags } from "#enums/objectFlags";
7
8
  import { SignatureFlags } from "#enums/signatureFlags";
@@ -9,17 +10,16 @@ import { SignatureKind } from "#enums/signatureKind";
9
10
  import { SymbolFlags } from "#enums/symbolFlags";
10
11
  import { TypeFlags } from "#enums/typeFlags";
11
12
  import { TypePredicateKind } from "#enums/typePredicateKind";
12
- import { type Expression, type Identifier, ModifierFlags, type Node, type Path, type SourceFile, type SyntaxKind, type TypeNode } from "../../ast/index.ts";
13
- import { type ObjectFactories, ObjectRegistry } from "../objectRegistry.ts";
13
+ import { type __String, type Expression, type Identifier, ModifierFlags, type Node, type Path, type SourceFile, type SyntaxKind, type TypeNode } from "../../ast/index.ts";
14
14
  import type { APIOptions, LSPConnectionOptions } from "../options.ts";
15
- import type { ConfigResponse, DocumentIdentifier, DocumentPosition, LSPUpdateSnapshotParams, ProjectResponse, SignatureResponse, SymbolResponse, TypeResponse, UpdateSnapshotParams, UpdateSnapshotResponse } from "../proto.ts";
15
+ import type { CompilerOptions, ConfigResponse, DocumentIdentifier, DocumentPosition, LSPUpdateSnapshotParams, ProjectResponse, SignatureResponse, SourceFileMetadata, SymbolResponse, TypeResponse, UpdateSnapshotParams, UpdateSnapshotResponse } from "../proto.ts";
16
16
  import { SourceFileCache } from "../sourceFileCache.ts";
17
+ import type { RequestTiming, TimingAccumulators, TimingInfo } from "../timing.ts";
17
18
  import { Client, type ClientSocketOptions, type ClientSpawnOptions } from "./client.ts";
18
- import type { AssertsIdentifierTypePredicate, AssertsThisTypePredicate, CompletionEntry, CompletionInfo, CompletionOptions, ConditionalType, Diagnostic, FreshableType, IdentifierTypePredicate, IndexedAccessType, IndexInfo, IndexType, InterfaceType, IntersectionType, IntrinsicType, LiteralType, ObjectType, StringMappingType, SubstitutionType, TemplateLiteralType, ThisTypePredicate, TupleType, Type, TypeParameter, TypePredicate, TypePredicateBase, TypeReference, UnionOrIntersectionType, UnionType } from "./types.ts";
19
- export { CompletionItemKind, DiagnosticCategory, ElementFlags, ModifierFlags, NodeBuilderFlags, ObjectFlags, SignatureFlags, SignatureKind, SymbolFlags, TypeFlags, TypePredicateKind };
20
- export type { APIOptions, ClientSocketOptions, ClientSpawnOptions, DocumentIdentifier, DocumentPosition, LSPConnectionOptions };
21
- export type { AssertsIdentifierTypePredicate, AssertsThisTypePredicate, CompletionEntry, CompletionInfo, CompletionOptions, ConditionalType, Diagnostic, FreshableType, IdentifierTypePredicate, IndexedAccessType, IndexInfo, IndexType, InterfaceType, IntersectionType, IntrinsicType, LiteralType, ObjectType, StringMappingType, SubstitutionType, TemplateLiteralType, ThisTypePredicate, TupleType, Type, TypeParameter, TypePredicate, TypePredicateBase, TypeReference, UnionOrIntersectionType, UnionType };
19
+ import type { AssertsIdentifierTypePredicate, AssertsThisTypePredicate, BigIntLiteralType, BooleanLiteralType, CompletionEntry, CompletionInfo, CompletionOptions, ConditionalType, Diagnostic, FreshableType, IdentifierTypePredicate, IndexedAccessType, IndexInfo, IndexType, InterfaceType, IntersectionType, IntrinsicType, JSDocTagInfo, LiteralType, NumberLiteralType, ObjectType, StringLiteralType, StringMappingType, SubstitutionType, TemplateLiteralType, ThisTypePredicate, TupleType, Type, TypeParameter, TypePredicate, TypePredicateBase, TypeReference, UnionOrIntersectionType, UnionType } from "./types.ts";
22
20
  export { documentURIToFileName, fileNameToDocumentURI } from "../path.ts";
21
+ export { CompletionItemKind, DiagnosticCategory, ElementFlags, ModifierFlags, ModuleKind, NodeBuilderFlags, ObjectFlags, SignatureFlags, SignatureKind, SymbolFlags, TypeFlags, TypePredicateKind };
22
+ export type { APIOptions, AssertsIdentifierTypePredicate, AssertsThisTypePredicate, BigIntLiteralType, BooleanLiteralType, ClientSocketOptions, ClientSpawnOptions, CompilerOptions, CompletionEntry, CompletionInfo, CompletionOptions, ConditionalType, Diagnostic, DocumentIdentifier, DocumentPosition, FreshableType, IdentifierTypePredicate, IndexedAccessType, IndexInfo, IndexType, InterfaceType, IntersectionType, IntrinsicType, JSDocTagInfo, LiteralType, LSPConnectionOptions, NumberLiteralType, ObjectType, RequestTiming, SourceFileMetadata, StringLiteralType, StringMappingType, SubstitutionType, TemplateLiteralType, ThisTypePredicate, TimingAccumulators, TimingInfo, TupleType, Type, TypeParameter, TypePredicate, TypePredicateBase, TypeReference, UnionOrIntersectionType, UnionType };
23
23
  export declare class API<FromLSP extends boolean = false> {
24
24
  private client;
25
25
  private sourceFileCache;
@@ -28,7 +28,7 @@ export declare class API<FromLSP extends boolean = false> {
28
28
  private activeSnapshots;
29
29
  private latestSnapshot;
30
30
  readonly internal: InternalAPI;
31
- constructor(options: APIOptions | LSPConnectionOptions);
31
+ constructor(options?: APIOptions | LSPConnectionOptions);
32
32
  /**
33
33
  * Create an API instance from an existing LSP connection's API session.
34
34
  * Use this when connecting to an API pipe provided by an LSP server via custom/initializeAPISession.
@@ -39,6 +39,20 @@ export declare class API<FromLSP extends boolean = false> {
39
39
  updateSnapshot(params?: FromLSP extends true ? LSPUpdateSnapshotParams : UpdateSnapshotParams): Promise<Snapshot>;
40
40
  close(): Promise<void>;
41
41
  clearSourceFileCache(): void;
42
+ /**
43
+ * Returns a snapshot of collected timing information for requests made
44
+ * through this API instance: client-measured round-trip latency and bytes
45
+ * transferred, folded together with the server's own per-request processing
46
+ * time and an estimated transport overhead (round-trip minus server time).
47
+ *
48
+ * Fetching the snapshot issues a lightweight request to the server to
49
+ * retrieve its timing collection. Collection must be enabled via the
50
+ * `collectTiming` option; when it is not, the returned snapshot has
51
+ * `enabled: false` and zeroed totals.
52
+ */
53
+ getTimingInfo(): Promise<TimingInfo>;
54
+ /** Clears all accumulated timing totals and recent-request history, on both the client and the server. */
55
+ resetTimingInfo(): Promise<void>;
42
56
  }
43
57
  export declare class InternalAPI {
44
58
  private client;
@@ -54,9 +68,9 @@ export declare class Snapshot {
54
68
  private projectMap;
55
69
  private toPath;
56
70
  private client;
57
- private objectRegistry;
58
71
  private disposed;
59
72
  private onDispose;
73
+ private snapshotRegistry;
60
74
  constructor(data: UpdateSnapshotResponse, client: Client, sourceFileCache: SourceFileCache, toPath: (fileName: string) => Path, onDispose: () => void);
61
75
  getProjects(): readonly Project[];
62
76
  getProject(configFileName: string): Project | undefined;
@@ -66,41 +80,102 @@ export declare class Snapshot {
66
80
  isDisposed(): boolean;
67
81
  private ensureNotDisposed;
68
82
  }
69
- declare class SnapshotObjectRegistry extends ObjectRegistry<Symbol, TypeObject, Signature> {
83
+ declare class SnapshotObjectRegistry {
84
+ private readonly symbols;
85
+ private readonly client;
86
+ private readonly snapshotId;
87
+ private readonly resolveProject;
88
+ constructor(client: Client, snapshotId: number, resolveProject: (projectId: Path) => Project | undefined);
89
+ /** Resolve a project id (a config file path) to its Project within this snapshot. */
90
+ getProject(projectId: Path): Project | undefined;
91
+ getOrCreateSymbol(data: SymbolResponse): Symbol;
92
+ getSymbol(id: number): Symbol | undefined;
93
+ clear(): void;
94
+ fetchSymbol(source: Symbol | Signature | Type, method: string, handle: number | undefined, projectId?: Path): Promise<Symbol>;
95
+ fetchSymbols(source: Symbol | Signature | Type, method: string, handles?: readonly number[], projectId?: Path): Promise<readonly Symbol[]>;
96
+ }
97
+ declare class ProjectObjectRegistry {
70
98
  private client;
71
99
  private snapshotId;
72
- constructor(factories: ObjectFactories<Symbol, TypeObject, Signature>, client: Client, snapshotId: number);
73
- fetchType<T extends Type>(source: Symbol | Signature | Type, method: string, handle: number | undefined): Promise<T>;
100
+ private project;
101
+ private snapshotRegistry;
102
+ private types;
103
+ private signatures;
104
+ constructor(client: Client, snapshotId: number, project: Project, snapshotRegistry: SnapshotObjectRegistry);
105
+ getOrCreateSymbol(data: SymbolResponse): Symbol;
106
+ getSymbol(id: number): Symbol | undefined;
107
+ getOrCreateType(data: TypeResponse): TypeObject;
108
+ getType(id: number): TypeObject | undefined;
109
+ getOrCreateSignature(data: SignatureResponse): Signature;
110
+ getSignature(id: number): Signature | undefined;
111
+ clear(): void;
112
+ fetchType<T extends Type>(source: Symbol | Signature | Type, method: string, handle: number | false | undefined): Promise<T>;
74
113
  fetchSymbol(source: Symbol | Signature | Type, method: string, handle: number | undefined): Promise<Symbol>;
75
114
  fetchSignature(source: Symbol | Signature | Type, method: string, handle: number | undefined): Promise<Signature>;
76
115
  fetchTypes(source: Symbol | Signature | Type, method: string, handles?: readonly number[]): Promise<readonly Type[]>;
77
116
  fetchSymbols(source: Symbol | Signature | Type, method: string, handles?: readonly number[]): Promise<readonly Symbol[]>;
117
+ fetchBaseTypes(source: Type): Promise<readonly Type[]>;
78
118
  }
79
119
  export declare class Project {
80
- readonly id: string;
120
+ readonly id: Path;
81
121
  readonly configFileName: string;
82
- readonly compilerOptions: Record<string, unknown>;
122
+ readonly compilerOptions: CompilerOptions;
83
123
  readonly rootFiles: readonly string[];
84
124
  readonly program: Program;
85
125
  readonly checker: Checker;
86
126
  readonly emitter: Emitter;
87
127
  private client;
88
- constructor(data: ProjectResponse, snapshotId: number, client: Client, objectRegistry: SnapshotObjectRegistry, sourceFileCache: SourceFileCache, toPath: (fileName: string) => Path);
128
+ constructor(data: ProjectResponse, snapshotId: number, client: Client, sourceFileCache: SourceFileCache, toPath: (fileName: string) => Path, snapshotRegistry: SnapshotObjectRegistry);
129
+ dispose(): void;
89
130
  }
90
131
  export declare class Program {
91
132
  private snapshotId;
92
- private projectId;
133
+ private project;
93
134
  private client;
94
135
  private sourceFileCache;
95
136
  private toPath;
96
137
  private decoder;
97
- constructor(snapshotId: number, projectId: string, client: Client, sourceFileCache: SourceFileCache, toPath: (fileName: string) => Path);
138
+ private sourceFileMetadataCache;
139
+ constructor(snapshotId: number, project: Project, client: Client, sourceFileCache: SourceFileCache, toPath: (fileName: string) => Path);
140
+ getCompilerOptions(): CompilerOptions;
98
141
  getSourceFile(file: DocumentIdentifier): Promise<SourceFile | undefined>;
142
+ getSourceFileNames(): Promise<readonly string[]>;
143
+ /**
144
+ * Returns program-stored metadata for the given source file, or `undefined` if the file
145
+ * is not part of the program. Metadata is fetched lazily per file and cached on this
146
+ * `Program` instance.
147
+ */
148
+ getSourceFileMetadata(fileName: string): Promise<SourceFileMetadata | undefined>;
149
+ /**
150
+ * Returns program-stored metadata for the source file at the given path, or `undefined`
151
+ * if the file is not part of the program. Like {@link getSourceFileMetadata}, but skips
152
+ * the file name to path conversion. Metadata is fetched lazily per file and cached on
153
+ * this `Program` instance.
154
+ */
155
+ getSourceFileMetadataByPath(path: Path): Promise<SourceFileMetadata | undefined>;
156
+ private fetchSourceFileMetadata;
157
+ /**
158
+ * Returns whether the given source file was loaded as part of an external library
159
+ * (e.g. a dependency resolved from `node_modules`). The underlying program metadata is
160
+ * fetched lazily per file and cached on this `Program` instance.
161
+ */
162
+ isSourceFileFromExternalLibrary(file: SourceFile): Promise<boolean>;
163
+ /**
164
+ * Returns whether the given source file is a default library file (e.g. `lib.d.ts`).
165
+ * The underlying program metadata is fetched lazily per file and cached on this
166
+ * `Program` instance.
167
+ */
168
+ isSourceFileDefaultLibrary(file: SourceFile): Promise<boolean>;
99
169
  /**
100
170
  * Get syntactic (parse) diagnostics for a specific file or all files.
101
171
  * @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
102
172
  */
103
173
  getSyntacticDiagnostics(file?: DocumentIdentifier): Promise<readonly Diagnostic[]>;
174
+ /**
175
+ * Get binder diagnostics for a specific file or all files.
176
+ * @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
177
+ */
178
+ getBindDiagnostics(file?: DocumentIdentifier): Promise<readonly Diagnostic[]>;
104
179
  /**
105
180
  * Get semantic (type-check) diagnostics for a specific file or all files.
106
181
  * @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
@@ -116,6 +191,14 @@ export declare class Program {
116
191
  * @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
117
192
  */
118
193
  getDeclarationDiagnostics(file?: DocumentIdentifier): Promise<readonly Diagnostic[]>;
194
+ /**
195
+ * Get program-wide diagnostics for the project, including compiler options diagnostics.
196
+ */
197
+ getProgramDiagnostics(): Promise<readonly Diagnostic[]>;
198
+ /**
199
+ * Get global (non-file-specific) semantic diagnostics for the project.
200
+ */
201
+ getGlobalDiagnostics(): Promise<readonly Diagnostic[]>;
119
202
  /**
120
203
  * Get config file parsing diagnostics for the project.
121
204
  */
@@ -123,17 +206,24 @@ export declare class Program {
123
206
  }
124
207
  export declare class Checker {
125
208
  private snapshotId;
126
- private projectId;
209
+ private project;
127
210
  private client;
128
211
  private objectRegistry;
129
- constructor(snapshotId: number, projectId: string, client: Client, objectRegistry: SnapshotObjectRegistry);
212
+ private wellKnownSymbols;
213
+ constructor(snapshotId: number, project: Project, client: Client, objectRegistry: ProjectObjectRegistry);
214
+ dispose(): void;
130
215
  getSymbolAtLocation(node: Node): Promise<Symbol | undefined>;
131
216
  getSymbolAtLocation(nodes: readonly Node[]): Promise<(Symbol | undefined)[]>;
132
217
  getSymbolAtPosition(file: DocumentIdentifier, position: number): Promise<Symbol | undefined>;
133
218
  getSymbolAtPosition(file: DocumentIdentifier, positions: readonly number[]): Promise<(Symbol | undefined)[]>;
134
219
  getTypeOfSymbol(symbol: Symbol): Promise<Type | undefined>;
135
220
  getTypeOfSymbol(symbols: readonly Symbol[]): Promise<(Type | undefined)[]>;
136
- getDeclaredTypeOfSymbol(symbol: Symbol): Promise<Type | undefined>;
221
+ /**
222
+ * Get the declared type of a symbol. Always returns a type; for symbols whose
223
+ * declared type cannot be determined the checker yields the error type (use
224
+ * {@link Type.isErrorType} to detect it).
225
+ */
226
+ getDeclaredTypeOfSymbol(symbol: Symbol): Promise<Type>;
137
227
  getReferencesToSymbolInFile(file: DocumentIdentifier, symbol: Symbol): Promise<NodeHandle[]>;
138
228
  getReferencedSymbolsForNode(node: Node, position: number): Promise<ReferencedSymbolEntry[]>;
139
229
  getSignatureUsage(signatureDecl: Node): Promise<SignatureUsage[]>;
@@ -155,7 +245,12 @@ export declare class Checker {
155
245
  isArrayLikeType(type: Type): Promise<boolean>;
156
246
  isTypeAssignableTo(source: Type, target: Type): Promise<boolean>;
157
247
  getShorthandAssignmentValueSymbol(node: Node): Promise<Symbol | undefined>;
158
- getTypeOfSymbolAtLocation(symbol: Symbol, location: Node): Promise<Type | undefined>;
248
+ /**
249
+ * Get the type of a symbol as narrowed at a specific location. Always returns
250
+ * a type; for symbols whose type cannot be determined the checker yields the
251
+ * error type (use {@link Type.isErrorType} to detect it).
252
+ */
253
+ getTypeOfSymbolAtLocation(symbol: Symbol, location: Node): Promise<Type>;
159
254
  private getIntrinsicType;
160
255
  getAnyType(): Promise<Type>;
161
256
  getStringType(): Promise<Type>;
@@ -172,19 +267,69 @@ export declare class Checker {
172
267
  signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): Promise<Node | undefined>;
173
268
  typeToString(type: Type, enclosingDeclaration?: Node, flags?: number): Promise<string>;
174
269
  isContextSensitive(node: Node): Promise<boolean>;
270
+ isArrayType(type: Type): Promise<boolean>;
271
+ isTupleType(type: Type): Promise<boolean>;
175
272
  getReturnTypeOfSignature(signature: Signature): Promise<Type | undefined>;
176
273
  getRestTypeOfSignature(signature: Signature): Promise<Type | undefined>;
177
274
  getTypePredicateOfSignature(signature: Signature): Promise<TypePredicate | undefined>;
178
- getBaseTypes(type: Type): Promise<readonly Type[]>;
275
+ /**
276
+ * Get the base types of a class or interface type. A type with no base types
277
+ * yields an empty array.
278
+ */
279
+ getBaseTypes(type: InterfaceType): Promise<readonly Type[]>;
280
+ getApparentType(type: Type): Promise<Type | undefined>;
179
281
  getPropertiesOfType(type: Type): Promise<readonly Symbol[]>;
180
282
  getIndexInfosOfType(type: Type): Promise<readonly IndexInfo[]>;
181
- getConstraintOfTypeParameter(type: Type): Promise<Type | undefined>;
182
- getTypeArguments(type: Type): Promise<readonly Type[]>;
283
+ /**
284
+ * Get the constraint of a type parameter (the `T` in `<U extends T>`), or
285
+ * undefined if it has none.
286
+ */
287
+ getConstraintOfTypeParameter(type: TypeParameter): Promise<Type | undefined>;
288
+ getBaseConstraintOfType(type: Type): Promise<Type | undefined>;
289
+ getPropertyOfType(type: Type, name: string): Promise<Symbol | undefined>;
290
+ getConstantValue(node: Node): Promise<string | number | undefined>;
291
+ getSignatureFromDeclaration(node: Node): Promise<Signature | undefined>;
292
+ getExportSpecifierLocalTargetSymbol(node: Node): Promise<Symbol | undefined>;
293
+ /**
294
+ * Follow all aliases to get the original symbol. Always returns a symbol; for
295
+ * an unresolved alias the checker yields the unknown symbol (use
296
+ * {@link Checker.isUnknownSymbol} to detect it).
297
+ */
298
+ getAliasedSymbol(symbol: Symbol): Promise<Symbol>;
299
+ getImmediateAliasedSymbol(symbol: Symbol): Promise<Symbol | undefined>;
300
+ /**
301
+ * Fetch (once, then cache) the handle ids of the per-checker singleton
302
+ * symbols (unknown, undefined, arguments). These ids are stable for the life
303
+ * of the project's checker, so identity checks against them are local after
304
+ * the first call.
305
+ */
306
+ private getWellKnownSymbols;
307
+ /**
308
+ * Returns `true` if the symbol is the checker's "unknown" symbol (e.g. the
309
+ * result of {@link Checker.getAliasedSymbol} on an unresolved alias).
310
+ */
311
+ isUnknownSymbol(symbol: Symbol): Promise<boolean>;
312
+ /**
313
+ * Returns `true` if the symbol is the checker's "undefined" symbol.
314
+ */
315
+ isUndefinedSymbol(symbol: Symbol): Promise<boolean>;
316
+ /**
317
+ * Returns `true` if the symbol is the checker's "arguments" symbol.
318
+ */
319
+ isArgumentsSymbol(symbol: Symbol): Promise<boolean>;
320
+ getExportsOfModule(symbol: Symbol): Promise<readonly Symbol[]>;
321
+ getMemberInModuleExports(symbol: Symbol, name: string): Promise<Symbol | undefined>;
322
+ getJsDocTagsOfSymbol(symbol: Symbol): Promise<readonly JSDocTagInfo[]>;
323
+ getDocumentationCommentOfSymbol(symbol: Symbol): Promise<string>;
324
+ /**
325
+ * Get the type arguments of a type reference (e.g. the `string` in `Array<string>`).
326
+ */
327
+ getTypeArguments(type: TypeReference): Promise<readonly Type[]>;
183
328
  }
184
329
  export interface PrintNodeOptions {
185
- preserveSourceNewlines?: boolean;
186
- neverAsciiEscape?: boolean;
187
- terminateUnterminatedLiterals?: boolean;
330
+ preserveSourceNewlines?: boolean | undefined;
331
+ neverAsciiEscape?: boolean | undefined;
332
+ terminateUnterminatedLiterals?: boolean | undefined;
188
333
  }
189
334
  export declare class Emitter {
190
335
  private client;
@@ -192,22 +337,29 @@ export declare class Emitter {
192
337
  printNode(node: Node, options?: PrintNodeOptions): Promise<string>;
193
338
  }
194
339
  export declare class NodeHandle {
340
+ /**
341
+ * The project this handle was produced in, used as the default for {@link resolve}.
342
+ * Node handles are only meaningful within a project's program, so the producing project
343
+ * is remembered so callers don't have to pass it explicitly.
344
+ */
345
+ private readonly canonicalProject;
195
346
  readonly index: number;
196
347
  readonly kind: SyntaxKind;
197
348
  readonly path: Path;
198
- constructor(handle: string);
349
+ constructor(handle: string, canonicalProject: Project);
199
350
  /**
200
- * Resolve this handle to the actual AST node by fetching the source file
201
- * from the given project and looking up the node by index.
351
+ * Resolve this handle to the actual AST node by fetching the source file from a project
352
+ * and looking up the node by index. If no project is passed, the project that produced
353
+ * the handle is used.
202
354
  */
203
- resolve(project: Project): Promise<Node | undefined>;
355
+ resolve(project?: Project): Promise<Node | undefined>;
204
356
  }
205
357
  /** A symbol definition paired with all of its reference nodes. */
206
358
  export interface ReferencedSymbolEntry {
207
359
  /** The node handle for the symbol's definition. */
208
360
  definition: NodeHandle;
209
361
  /** The resolved symbol for the definition, if available. */
210
- symbol?: Symbol;
362
+ symbol?: Symbol | undefined;
211
363
  /** The node handles for each reference to the symbol. */
212
364
  references: NodeHandle[];
213
365
  }
@@ -216,23 +368,45 @@ export interface SignatureUsage {
216
368
  /** The node handle for the name reference. */
217
369
  name: NodeHandle;
218
370
  /** The node handle for the call expression, if the reference is invoked. */
219
- call?: NodeHandle;
371
+ call?: NodeHandle | undefined;
220
372
  }
221
373
  export declare class Symbol {
222
374
  private objectRegistry;
375
+ /**
376
+ * The project this symbol was first observed in, used as the default project for
377
+ * lookups that need a project context (members/exports/parent). Symbols are shared
378
+ * snapshot-wide, so these lookups can otherwise be ambiguous about which project to use.
379
+ */
380
+ private readonly canonicalProject;
223
381
  readonly id: number;
382
+ /** The escaped (`__String`) name, used as the key in member/export tables. */
383
+ readonly escapedName: __String;
384
+ /** The display name (escaped underscores removed). */
224
385
  readonly name: string;
225
386
  readonly flags: SymbolFlags;
226
387
  readonly checkFlags: number;
227
388
  readonly declarations: readonly NodeHandle[];
228
389
  readonly valueDeclaration: NodeHandle | undefined;
229
- readonly parent: number;
230
- readonly exportSymbol: number;
390
+ private readonly parent;
391
+ private readonly exportSymbol;
392
+ private membersCache;
393
+ private exportsCache;
231
394
  constructor(data: SymbolResponse, objectRegistry: SnapshotObjectRegistry);
232
395
  getParent(): Promise<Symbol | undefined>;
233
- getMembers(): Promise<readonly Symbol[]>;
234
- getExports(): Promise<readonly Symbol[]>;
396
+ /**
397
+ * Get this symbol's members keyed by escaped name. The result is cached on
398
+ * the symbol, so repeated calls do not round-trip to the server.
399
+ */
400
+ getMembers(): Promise<ReadonlyMap<__String, Symbol>>;
401
+ /**
402
+ * Get this symbol's exports keyed by escaped name. The result is cached on
403
+ * the symbol, so repeated calls do not round-trip to the server.
404
+ */
405
+ getExports(): Promise<ReadonlyMap<__String, Symbol>>;
406
+ private fetchSymbolTable;
235
407
  getExportSymbol(): Promise<Symbol>;
408
+ getJsDocTags(checker: Checker): Promise<readonly JSDocTagInfo[]>;
409
+ getDocumentationComment(checker: Checker): Promise<string>;
236
410
  }
237
411
  declare class TypeObject implements Type {
238
412
  private objectRegistry;
@@ -240,7 +414,7 @@ declare class TypeObject implements Type {
240
414
  readonly flags: TypeFlags;
241
415
  readonly objectFlags: ObjectFlags;
242
416
  readonly symbol: number;
243
- readonly value: string | number | boolean;
417
+ readonly value: string | number | boolean | bigint;
244
418
  readonly intrinsicName: string;
245
419
  readonly isThisType: boolean;
246
420
  readonly freshType: number;
@@ -261,16 +435,18 @@ declare class TypeObject implements Type {
261
435
  readonly extendsType: number;
262
436
  readonly baseType: number;
263
437
  readonly substConstraint: number;
264
- constructor(data: TypeResponse, objectRegistry: SnapshotObjectRegistry);
438
+ private trueType;
439
+ private falseType;
440
+ constructor(data: TypeResponse, objectRegistry: ProjectObjectRegistry);
265
441
  getSymbol(): Promise<Symbol | undefined>;
266
442
  getAliasSymbol(): Promise<Symbol | undefined>;
267
443
  getTarget(): Promise<Type>;
268
444
  getFreshType(): Promise<FreshableType | undefined>;
269
445
  getRegularType(): Promise<FreshableType | undefined>;
270
- getTypes(): Promise<readonly Type[]>;
271
- getTypeParameters(): Promise<readonly Type[]>;
272
- getOuterTypeParameters(): Promise<readonly Type[]>;
273
- getLocalTypeParameters(): Promise<readonly Type[]>;
446
+ getTypes(): Promise<readonly Type[] | undefined>;
447
+ getTypeParameters(): Promise<readonly TypeParameter[]>;
448
+ getOuterTypeParameters(): Promise<readonly TypeParameter[]>;
449
+ getLocalTypeParameters(): Promise<readonly TypeParameter[]>;
274
450
  getAliasTypeArguments(): Promise<readonly Type[]>;
275
451
  getObjectType(): Promise<Type>;
276
452
  getIndexType(): Promise<Type>;
@@ -278,7 +454,60 @@ declare class TypeObject implements Type {
278
454
  getExtendsType(): Promise<Type>;
279
455
  getBaseType(): Promise<Type>;
280
456
  getConstraint(): Promise<Type>;
457
+ getTrueType(): Promise<Type>;
458
+ getFalseType(): Promise<Type>;
459
+ /**
460
+ * Get the base types of this type. Returns `undefined` for any type that is
461
+ * not a class or interface.
462
+ */
463
+ getBaseTypes(): Promise<readonly Type[] | undefined>;
464
+ isClassOrInterface(): this is InterfaceType;
465
+ isUnionType(): this is UnionType;
466
+ isIntersectionType(): this is IntersectionType;
467
+ isObjectType(): this is ObjectType;
468
+ isIntrinsicType(): this is IntrinsicType;
469
+ isErrorType(): boolean;
470
+ isLiteralType(): this is LiteralType;
471
+ isStringLiteralType(): this is StringLiteralType;
472
+ isNumberLiteralType(): this is NumberLiteralType;
473
+ isBigIntLiteralType(): this is BigIntLiteralType;
474
+ isBooleanLiteralType(): this is BooleanLiteralType;
475
+ isTypeReference(): this is TypeReference;
476
+ isTupleType(): this is TupleType;
477
+ isIndexType(): this is IndexType;
478
+ isIndexedAccessType(): this is IndexedAccessType;
479
+ isConditionalType(): this is ConditionalType;
480
+ isSubstitutionType(): this is SubstitutionType;
481
+ isTemplateLiteralType(): this is TemplateLiteralType;
482
+ isStringMappingType(): this is StringMappingType;
483
+ isTypeParameter(): this is TypeParameter;
281
484
  }
485
+ export declare function isUnionType(type: Type): type is UnionType;
486
+ export declare function isIntersectionType(type: Type): type is IntersectionType;
487
+ export declare function isObjectType(type: Type): type is ObjectType;
488
+ export declare function isClassOrInterfaceType(type: Type): type is InterfaceType;
489
+ export declare function isIntrinsicType(type: Type): type is IntrinsicType;
490
+ /**
491
+ * Whether this is the error type — the placeholder the checker produces when a
492
+ * type cannot be determined (e.g. an unresolved reference). It is an intrinsic
493
+ * type named `"error"` (this covers both the singleton error type and the
494
+ * per-alias error types manufactured for unresolved type alias references).
495
+ */
496
+ export declare function isErrorType(type: Type): boolean;
497
+ export declare function isLiteralType(type: Type): type is LiteralType;
498
+ export declare function isStringLiteralType(type: Type): type is StringLiteralType;
499
+ export declare function isNumberLiteralType(type: Type): type is NumberLiteralType;
500
+ export declare function isBigIntLiteralType(type: Type): type is BigIntLiteralType;
501
+ export declare function isBooleanLiteralType(type: Type): type is BooleanLiteralType;
502
+ export declare function isTypeReference(type: Type): type is TypeReference;
503
+ export declare function isTupleType(type: Type): type is TupleType;
504
+ export declare function isIndexType(type: Type): type is IndexType;
505
+ export declare function isIndexedAccessType(type: Type): type is IndexedAccessType;
506
+ export declare function isConditionalType(type: Type): type is ConditionalType;
507
+ export declare function isSubstitutionType(type: Type): type is SubstitutionType;
508
+ export declare function isTemplateLiteralType(type: Type): type is TemplateLiteralType;
509
+ export declare function isStringMappingType(type: Type): type is StringMappingType;
510
+ export declare function isTypeParameter(type: Type): type is TypeParameter;
282
511
  export declare class Signature {
283
512
  private flags;
284
513
  private objectRegistry;
@@ -288,8 +517,8 @@ export declare class Signature {
288
517
  readonly parameters: readonly number[];
289
518
  readonly thisParameter?: number | undefined;
290
519
  readonly target?: number | undefined;
291
- constructor(data: SignatureResponse, objectRegistry: SnapshotObjectRegistry);
292
- getTypeParameters(): Promise<readonly Type[]>;
520
+ constructor(data: SignatureResponse, project: Project, objectRegistry: ProjectObjectRegistry);
521
+ getTypeParameters(): Promise<readonly TypeParameter[]>;
293
522
  getParameters(): Promise<readonly Symbol[]>;
294
523
  getThisParameter(): Promise<Symbol | undefined>;
295
524
  getTarget(): Promise<Signature | undefined>;