typescript 5.5.3 → 5.6.0-beta

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.
@@ -214,6 +214,22 @@ declare namespace ts {
214
214
  * The time spent creating or updating the auto-import program, in milliseconds.
215
215
  */
216
216
  createAutoImportProviderProgramDurationMs?: number;
217
+ /**
218
+ * The time spent computing diagnostics, in milliseconds.
219
+ */
220
+ diagnosticsDuration?: FileDiagnosticPerformanceData[];
221
+ }
222
+ /**
223
+ * Time spent computing each kind of diagnostics, in milliseconds.
224
+ */
225
+ export type DiagnosticPerformanceData = {
226
+ [Kind in DiagnosticEventKind]?: number;
227
+ };
228
+ export interface FileDiagnosticPerformanceData extends DiagnosticPerformanceData {
229
+ /**
230
+ * The file for which the performance data is reported.
231
+ */
232
+ file: string;
217
233
  }
218
234
  /**
219
235
  * Arguments for FileRequest messages.
@@ -584,23 +600,7 @@ declare namespace ts {
584
600
  }
585
601
  export interface ApplyCodeActionCommandResponse extends Response {
586
602
  }
587
- export interface FileRangeRequestArgs extends FileRequestArgs {
588
- /**
589
- * The line number for the request (1-based).
590
- */
591
- startLine: number;
592
- /**
593
- * The character offset (on the line) for the request (1-based).
594
- */
595
- startOffset: number;
596
- /**
597
- * The line number for the request (1-based).
598
- */
599
- endLine: number;
600
- /**
601
- * The character offset (on the line) for the request (1-based).
602
- */
603
- endOffset: number;
603
+ export interface FileRangeRequestArgs extends FileRequestArgs, FileRange {
604
604
  }
605
605
  /**
606
606
  * Instances of this interface specify errorcodes on a specific location in a sourcefile.
@@ -1866,7 +1866,7 @@ declare namespace ts {
1866
1866
  * List of file names for which to compute compiler errors.
1867
1867
  * The files will be checked in list order.
1868
1868
  */
1869
- files: string[];
1869
+ files: (string | FileRangesRequestArgs)[];
1870
1870
  /**
1871
1871
  * Delay in milliseconds to wait before starting to compute
1872
1872
  * errors for the files in the file list
@@ -1887,6 +1887,27 @@ declare namespace ts {
1887
1887
  command: CommandTypes.Geterr;
1888
1888
  arguments: GeterrRequestArgs;
1889
1889
  }
1890
+ export interface FileRange {
1891
+ /**
1892
+ * The line number for the request (1-based).
1893
+ */
1894
+ startLine: number;
1895
+ /**
1896
+ * The character offset (on the line) for the request (1-based).
1897
+ */
1898
+ startOffset: number;
1899
+ /**
1900
+ * The line number for the request (1-based).
1901
+ */
1902
+ endLine: number;
1903
+ /**
1904
+ * The character offset (on the line) for the request (1-based).
1905
+ */
1906
+ endOffset: number;
1907
+ }
1908
+ export interface FileRangesRequestArgs extends Pick<FileRequestArgs, "file"> {
1909
+ ranges: FileRange[];
1910
+ }
1890
1911
  export type RequestCompletedEventName = "requestCompleted";
1891
1912
  /**
1892
1913
  * Event that is sent when server have finished processing request with specified id.
@@ -1897,6 +1918,7 @@ declare namespace ts {
1897
1918
  }
1898
1919
  export interface RequestCompletedEventBody {
1899
1920
  request_seq: number;
1921
+ performanceData?: PerformanceData;
1900
1922
  }
1901
1923
  /**
1902
1924
  * Item of diagnostic information found in a DiagnosticEvent message.
@@ -1969,8 +1991,12 @@ declare namespace ts {
1969
1991
  * An array of diagnostic information items.
1970
1992
  */
1971
1993
  diagnostics: Diagnostic[];
1994
+ /**
1995
+ * Spans where the region diagnostic was requested, if this is a region semantic diagnostic event.
1996
+ */
1997
+ spans?: TextSpan[];
1972
1998
  }
1973
- export type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag";
1999
+ export type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag" | "regionSemanticDiag";
1974
2000
  /**
1975
2001
  * Event message for DiagnosticEventKind event types.
1976
2002
  * These events provide syntactic and semantic errors for a file.
@@ -2510,6 +2536,7 @@ declare namespace ts {
2510
2536
  private readonly knownCachesSet;
2511
2537
  private readonly projectWatchers;
2512
2538
  private safeList;
2539
+ private pendingRunRequests;
2513
2540
  private installRunCount;
2514
2541
  private inFlightRequestCount;
2515
2542
  abstract readonly typesRegistry: Map<string, MapLike<string>>;
@@ -2636,6 +2663,7 @@ declare namespace ts {
2636
2663
  interface ServerHost extends System {
2637
2664
  watchFile(path: string, callback: FileWatcherCallback, pollingInterval?: number, options?: WatchOptions): FileWatcher;
2638
2665
  watchDirectory(path: string, callback: DirectoryWatcherCallback, recursive?: boolean, options?: WatchOptions): FileWatcher;
2666
+ preferNonRecursiveWatch?: boolean;
2639
2667
  setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
2640
2668
  clearTimeout(timeoutId: any): void;
2641
2669
  setImmediate(callback: (...args: any[]) => void, ...args: any[]): any;
@@ -2644,6 +2672,18 @@ declare namespace ts {
2644
2672
  trace?(s: string): void;
2645
2673
  require?(initialPath: string, moduleName: string): ModuleImportResult;
2646
2674
  }
2675
+ interface InstallPackageOptionsWithProject extends InstallPackageOptions {
2676
+ projectName: string;
2677
+ projectRootPath: Path;
2678
+ }
2679
+ interface ITypingsInstaller {
2680
+ isKnownTypesPackageName(name: string): boolean;
2681
+ installPackage(options: InstallPackageOptionsWithProject): Promise<ApplyCodeActionCommandResult>;
2682
+ enqueueInstallTypingsRequest(p: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string> | undefined): void;
2683
+ attach(projectService: ProjectService): void;
2684
+ onProjectClosed(p: Project): void;
2685
+ readonly globalTypingsCacheLocation: string | undefined;
2686
+ }
2647
2687
  function createInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string>, cachePath?: string): DiscoverTypings;
2648
2688
  function toNormalizedPath(fileName: string): NormalizedPath;
2649
2689
  function normalizedPathToPath(normalizedPath: NormalizedPath, currentDirectory: string, getCanonicalFileName: (f: string) => string): Path;
@@ -2702,6 +2742,7 @@ declare namespace ts {
2702
2742
  readonly containingProjects: Project[];
2703
2743
  private formatSettings;
2704
2744
  private preferences;
2745
+ private realpath;
2705
2746
  constructor(host: ServerHost, fileName: NormalizedPath, scriptKind: ScriptKind, hasMixedContent: boolean, path: Path, initialVersion?: number);
2706
2747
  isScriptOpen(): boolean;
2707
2748
  open(newText: string | undefined): void;
@@ -2735,19 +2776,6 @@ declare namespace ts {
2735
2776
  positionToLineOffset(position: number): protocol.Location;
2736
2777
  isJavaScript(): boolean;
2737
2778
  }
2738
- interface InstallPackageOptionsWithProject extends InstallPackageOptions {
2739
- projectName: string;
2740
- projectRootPath: Path;
2741
- }
2742
- interface ITypingsInstaller {
2743
- isKnownTypesPackageName(name: string): boolean;
2744
- installPackage(options: InstallPackageOptionsWithProject): Promise<ApplyCodeActionCommandResult>;
2745
- enqueueInstallTypingsRequest(p: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string> | undefined): void;
2746
- attach(projectService: ProjectService): void;
2747
- onProjectClosed(p: Project): void;
2748
- readonly globalTypingsCacheLocation: string | undefined;
2749
- }
2750
- const nullTypingsInstaller: ITypingsInstaller;
2751
2779
  function allRootFilesAreJsOrDts(project: Project): boolean;
2752
2780
  function allFilesAreJsOrDts(project: Project): boolean;
2753
2781
  enum ProjectKind {
@@ -2789,33 +2817,31 @@ declare namespace ts {
2789
2817
  private externalFiles;
2790
2818
  private missingFilesMap;
2791
2819
  private generatedFilesMap;
2820
+ private hasAddedorRemovedFiles;
2821
+ private hasAddedOrRemovedSymlinks;
2792
2822
  protected languageService: LanguageService;
2793
2823
  languageServiceEnabled: boolean;
2794
2824
  readonly trace?: (s: string) => void;
2795
2825
  readonly realpath?: (path: string) => string;
2796
2826
  private builderState;
2797
- /**
2798
- * Set of files names that were updated since the last call to getChangesSinceVersion.
2799
- */
2800
2827
  private updatedFileNames;
2801
- /**
2802
- * Set of files that was returned from the last call to getChangesSinceVersion.
2803
- */
2804
2828
  private lastReportedFileNames;
2805
- /**
2806
- * Last version that was reported.
2807
- */
2808
2829
  private lastReportedVersion;
2809
2830
  protected projectErrors: Diagnostic[] | undefined;
2810
2831
  protected isInitialLoadPending: () => boolean;
2832
+ private typingsCache;
2833
+ private typingWatchers;
2811
2834
  private readonly cancellationToken;
2812
2835
  isNonTsProject(): boolean;
2813
2836
  isJsOnlyProject(): boolean;
2814
2837
  static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void): {} | undefined;
2838
+ private exportMapCache;
2839
+ private changedFilesForExportMapCache;
2840
+ private moduleSpecifierCache;
2841
+ private symlinks;
2815
2842
  readonly jsDocParsingMode: JSDocParsingMode | undefined;
2816
2843
  isKnownTypesPackageName(name: string): boolean;
2817
2844
  installPackage(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>;
2818
- private get typingsCache();
2819
2845
  getCompilationSettings(): ts.CompilerOptions;
2820
2846
  getCompilerOptions(): ts.CompilerOptions;
2821
2847
  getNewLine(): string;
@@ -2882,6 +2908,8 @@ declare namespace ts {
2882
2908
  * @returns: true if set of files in the project stays the same and false - otherwise.
2883
2909
  */
2884
2910
  updateGraph(): boolean;
2911
+ private closeWatchingTypingLocations;
2912
+ private onTypingInstallerWatchInvoke;
2885
2913
  protected removeExistingTypings(include: string[]): string[];
2886
2914
  private updateGraphWorker;
2887
2915
  private detachScriptInfoFromProject;
@@ -2893,6 +2921,7 @@ declare namespace ts {
2893
2921
  getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo | undefined;
2894
2922
  getScriptInfo(uncheckedFileName: string): ts.server.ScriptInfo | undefined;
2895
2923
  filesToString(writeProjectFileNames: boolean): string;
2924
+ private filesToStringWorker;
2896
2925
  setCompilerOptions(compilerOptions: CompilerOptions): void;
2897
2926
  setTypeAcquisition(newTypeAcquisition: TypeAcquisition | undefined): void;
2898
2927
  getTypeAcquisition(): ts.TypeAcquisition;
@@ -2901,6 +2930,8 @@ declare namespace ts {
2901
2930
  protected enablePlugin(pluginConfigEntry: PluginImport, searchPaths: string[]): void;
2902
2931
  /** Starts a new check for diagnostics. Call this if some file has updated that would cause diagnostics to be changed. */
2903
2932
  refreshDiagnostics(): void;
2933
+ private isDefaultProjectForOpenFiles;
2934
+ private getCompilerOptionsForNoDtsResolutionProject;
2904
2935
  }
2905
2936
  /**
2906
2937
  * If a file is opened and no tsconfig (or jsconfig) is found,
@@ -2920,6 +2951,7 @@ declare namespace ts {
2920
2951
  }
2921
2952
  class AutoImportProviderProject extends Project {
2922
2953
  private hostProject;
2954
+ private static readonly maxDependencies;
2923
2955
  private rootFileNames;
2924
2956
  updateGraph(): boolean;
2925
2957
  hasRoots(): boolean;
@@ -2936,6 +2968,8 @@ declare namespace ts {
2936
2968
  class ConfiguredProject extends Project {
2937
2969
  readonly canonicalConfigFilePath: NormalizedPath;
2938
2970
  private projectReferences;
2971
+ private compilerHost?;
2972
+ private releaseParsedConfig;
2939
2973
  /**
2940
2974
  * If the project has reload from disk pending, it reloads (and then updates graph as part of that) instead of just updating the graph
2941
2975
  * @returns: true if set of files in the project stays the same and false - otherwise.
@@ -3126,6 +3160,7 @@ declare namespace ts {
3126
3160
  configFileName?: NormalizedPath;
3127
3161
  configFileErrors?: readonly Diagnostic[];
3128
3162
  }
3163
+ const nullTypingsInstaller: ITypingsInstaller;
3129
3164
  interface ProjectServiceOptions {
3130
3165
  host: ServerHost;
3131
3166
  logger: Logger;
@@ -3151,16 +3186,8 @@ declare namespace ts {
3151
3186
  }
3152
3187
  class ProjectService {
3153
3188
  private readonly nodeModulesWatchers;
3154
- /**
3155
- * Contains all the deleted script info's version information so that
3156
- * it does not reset when creating script info again
3157
- * (and could have potentially collided with version where contents mismatch)
3158
- */
3159
3189
  private readonly filenameToScriptInfoVersion;
3160
3190
  private readonly allJsFilesForOpenFileTelemetry;
3161
- /**
3162
- * maps external project file name to list of config files that were the part of this project
3163
- */
3164
3191
  private readonly externalProjectToConfiguredProjectMap;
3165
3192
  /**
3166
3193
  * external projects (configuration and list of root files is not controlled by tsserver)
@@ -3178,13 +3205,8 @@ declare namespace ts {
3178
3205
  * Open files: with value being project root path, and key being Path of the file that is open
3179
3206
  */
3180
3207
  readonly openFiles: Map<Path, NormalizedPath | undefined>;
3181
- /** Config files looked up and cached config files for open script info */
3182
3208
  private readonly configFileForOpenFiles;
3183
- /** Set of open script infos that are root of inferred project */
3184
3209
  private rootOfInferredProjects;
3185
- /**
3186
- * Map of open files that are opened without complete path but have projectRoot as current directory
3187
- */
3188
3210
  private readonly openFilesWithNonRootedDiskPath;
3189
3211
  private compilerOptionsForInferredProjects;
3190
3212
  private compilerOptionsForInferredProjectsPerProjectRoot;
@@ -3192,18 +3214,11 @@ declare namespace ts {
3192
3214
  private watchOptionsForInferredProjectsPerProjectRoot;
3193
3215
  private typeAcquisitionForInferredProjects;
3194
3216
  private typeAcquisitionForInferredProjectsPerProjectRoot;
3195
- /**
3196
- * Project size for configured or external projects
3197
- */
3198
3217
  private readonly projectToSizeMap;
3199
3218
  private readonly hostConfiguration;
3200
3219
  private safelist;
3201
3220
  private readonly legacySafelist;
3202
3221
  private pendingProjectUpdates;
3203
- /**
3204
- * All the open script info that needs recalculation of the default project,
3205
- * this also caches config file info before config file change was detected to use it in case projects are not updated yet
3206
- */
3207
3222
  private pendingOpenFileProjectUpdates?;
3208
3223
  readonly currentDirectory: NormalizedPath;
3209
3224
  readonly toCanonicalFileName: (f: string) => string;
@@ -3221,8 +3236,11 @@ declare namespace ts {
3221
3236
  readonly allowLocalPluginLoads: boolean;
3222
3237
  readonly typesMapLocation: string | undefined;
3223
3238
  readonly serverMode: LanguageServiceMode;
3224
- /** Tracks projects that we have already sent telemetry for. */
3225
3239
  private readonly seenProjects;
3240
+ private readonly sharedExtendedConfigFileWatchers;
3241
+ private readonly extendedConfigCache;
3242
+ private packageJsonFilesMap;
3243
+ private incompleteCompletionsCache;
3226
3244
  private performanceEventHandler?;
3227
3245
  private pendingPluginEnablements?;
3228
3246
  private currentPluginEnablementPromise?;
@@ -3236,20 +3254,9 @@ declare namespace ts {
3236
3254
  setCompilerOptionsForInferredProjects(projectCompilerOptions: protocol.InferredProjectCompilerOptions, projectRootPath?: string): void;
3237
3255
  findProject(projectName: string): Project | undefined;
3238
3256
  getDefaultProjectForFile(fileName: NormalizedPath, ensureProject: boolean): Project | undefined;
3239
- /**
3240
- * If there is default project calculation pending for this file,
3241
- * then it completes that calculation so that correct default project is used for the project
3242
- */
3243
3257
  private tryGetDefaultProjectForEnsuringConfiguredProjectForFile;
3244
3258
  private doEnsureDefaultProjectForFile;
3245
3259
  getScriptInfoEnsuringProjectsUptoDate(uncheckedFileName: string): ScriptInfo | undefined;
3246
- /**
3247
- * Ensures the project structures are upto date
3248
- * This means,
3249
- * - we go through all the projects and update them if they are dirty
3250
- * - if updates reflect some change in structure or there was pending request to ensure projects for open files
3251
- * ensure that each open script info has project
3252
- */
3253
3260
  private ensureProjectStructuresUptoDate;
3254
3261
  getFormatCodeOptions(file: NormalizedPath): FormatCodeSettings;
3255
3262
  getPreferences(file: NormalizedPath): protocol.UserPreferences;
@@ -3260,37 +3267,29 @@ declare namespace ts {
3260
3267
  private delayUpdateSourceInfoProjects;
3261
3268
  private delayUpdateProjectsOfScriptInfoPath;
3262
3269
  private handleDeletedFile;
3270
+ private watchWildcardDirectory;
3271
+ private delayUpdateProjectsFromParsedConfigOnConfigFileChange;
3272
+ private onConfigFileChanged;
3263
3273
  private removeProject;
3264
3274
  private assignOrphanScriptInfosToInferredProject;
3265
- /**
3266
- * Remove this file from the set of open, non-configured files.
3267
- * @param info The file that has been closed or newly configured
3268
- */
3269
3275
  private closeOpenFile;
3270
3276
  private deleteScriptInfo;
3271
3277
  private configFileExists;
3272
- /**
3273
- * This function tries to search for a tsconfig.json for the given file.
3274
- * This is different from the method the compiler uses because
3275
- * the compiler can assume it will always start searching in the
3276
- * current directory (the directory in which tsc was invoked).
3277
- * The server must start searching from the directory containing
3278
- * the newly opened file.
3279
- */
3278
+ private createConfigFileWatcherForParsedConfig;
3280
3279
  private forEachConfigFileLocation;
3281
- /** Get cached configFileName for scriptInfo or ancestor of open script info */
3282
3280
  private getConfigFileNameForFileFromCache;
3283
- /** Caches the configFilename for script info or ancestor of open script info */
3284
3281
  private setConfigFileNameForFileInCache;
3285
3282
  private printProjects;
3286
3283
  private getConfiguredProjectByCanonicalConfigFilePath;
3287
3284
  private findExternalProjectByProjectName;
3288
- /** Get a filename if the language service exceeds the maximum allowed program size; otherwise returns undefined. */
3289
3285
  private getFilenameForExceededTotalSizeLimitForNonTsFiles;
3290
3286
  private createExternalProject;
3291
3287
  private addFilesToNonInferredProject;
3288
+ private loadConfiguredProject;
3292
3289
  private updateNonInferredProjectFiles;
3293
3290
  private updateRootAndOptionsOfNonInferredProject;
3291
+ private reloadFileNamesOfParsedConfig;
3292
+ private clearSemanticCache;
3294
3293
  private getOrCreateInferredProjectForProjectRootPathIfEnabled;
3295
3294
  private getOrCreateSingleInferredProjectIfEnabled;
3296
3295
  private getOrCreateSingleInferredWithoutProjectRoot;
@@ -3316,23 +3315,14 @@ declare namespace ts {
3316
3315
  private addSourceInfoToSourceMap;
3317
3316
  private addMissingSourceMapFile;
3318
3317
  setHostConfiguration(args: protocol.ConfigureRequestArguments): void;
3318
+ private getWatchOptionsFromProjectWatchOptions;
3319
3319
  closeLog(): void;
3320
3320
  /**
3321
3321
  * This function rebuilds the project for every file opened by the client
3322
3322
  * This does not reload contents of open files from disk. But we could do that if needed
3323
3323
  */
3324
3324
  reloadProjects(): void;
3325
- /**
3326
- * Remove the root of inferred project if script info is part of another project
3327
- */
3328
3325
  private removeRootOfInferredProjectIfNowPartOfOtherProject;
3329
- /**
3330
- * This function is to update the project structure for every inferred project.
3331
- * It is called on the premise that all the configured projects are
3332
- * up to date.
3333
- * This will go through open files and assign them to inferred project if open file is not part of any other project
3334
- * After that all the inferred project graphs are updated
3335
- */
3336
3326
  private ensureProjectForOpenFiles;
3337
3327
  /**
3338
3328
  * Open file whose contents is managed by the client
@@ -3343,16 +3333,7 @@ declare namespace ts {
3343
3333
  private findExternalProjectContainingOpenScriptInfo;
3344
3334
  private getOrCreateOpenScriptInfo;
3345
3335
  private assignProjectToOpenedScriptInfo;
3346
- /**
3347
- * Finds the default configured project for given info
3348
- * For any tsconfig found, it looks into that project, if not then all its references,
3349
- * The search happens for all tsconfigs till projectRootPath
3350
- */
3351
3336
  private tryFindDefaultConfiguredProjectForOpenScriptInfo;
3352
- /**
3353
- * Finds the default configured project, if found, it creates the solution projects (does not load them right away)
3354
- * with Find: finds the projects even if the project is deferredClosed
3355
- */
3356
3337
  private tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo;
3357
3338
  private ensureProjectChildren;
3358
3339
  private cleanupConfiguredProjects;
@@ -3368,7 +3349,6 @@ declare namespace ts {
3368
3349
  private collectChanges;
3369
3350
  closeExternalProject(uncheckedFileName: string): void;
3370
3351
  openExternalProjects(projects: protocol.ExternalProject[]): void;
3371
- /** Makes a filename safe to insert in a RegExp */
3372
3352
  private static readonly filenameEscapeRegexp;
3373
3353
  private static escapeFilenameForRegex;
3374
3354
  resetSafeList(): void;
@@ -3376,9 +3356,12 @@ declare namespace ts {
3376
3356
  private applySafeListWorker;
3377
3357
  openExternalProject(proj: protocol.ExternalProject): void;
3378
3358
  hasDeferredExtension(): boolean;
3359
+ private endEnablePlugin;
3379
3360
  private enableRequestedPluginsAsync;
3380
3361
  private enableRequestedPluginsWorker;
3381
3362
  configurePlugin(args: protocol.ConfigurePluginRequestArguments): void;
3363
+ private watchPackageJsonFile;
3364
+ private onPackageJsonChange;
3382
3365
  }
3383
3366
  function formatMessage<T extends protocol.Message>(msg: T, logger: Logger, byteLength: (s: string, encoding: BufferEncoding) => number, newLine: string): string;
3384
3367
  interface ServerCancellationToken extends HostCancellationToken {
@@ -3386,10 +3369,6 @@ declare namespace ts {
3386
3369
  resetRequest(requestId: number): void;
3387
3370
  }
3388
3371
  const nullCancellationToken: ServerCancellationToken;
3389
- interface PendingErrorCheck {
3390
- fileName: NormalizedPath;
3391
- project: Project;
3392
- }
3393
3372
  /** @deprecated use ts.server.protocol.CommandTypes */
3394
3373
  type CommandNames = protocol.CommandTypes;
3395
3374
  /** @deprecated use ts.server.protocol.CommandTypes */
@@ -3449,6 +3428,7 @@ declare namespace ts {
3449
3428
  constructor(opts: SessionOptions);
3450
3429
  private sendRequestCompletedEvent;
3451
3430
  private addPerformanceData;
3431
+ private addDiagnosticsPerformanceData;
3452
3432
  private performanceEventHandler;
3453
3433
  private defaultEventHandler;
3454
3434
  private projectsUpdatedInBackgroundEvent;
@@ -3460,8 +3440,8 @@ declare namespace ts {
3460
3440
  private semanticCheck;
3461
3441
  private syntacticCheck;
3462
3442
  private suggestionCheck;
3443
+ private regionSemanticCheck;
3463
3444
  private sendDiagnosticsEvent;
3464
- /** It is the caller's responsibility to verify that `!this.suppressDiagnosticEvents`. */
3465
3445
  private updateErrorCheck;
3466
3446
  private cleanProjects;
3467
3447
  private cleanup;
@@ -3508,10 +3488,6 @@ declare namespace ts {
3508
3488
  private toSpanGroups;
3509
3489
  private getReferences;
3510
3490
  private getFileReferences;
3511
- /**
3512
- * @param fileName is the name of the file to be opened
3513
- * @param fileContent is a version of the file content that is known to be more up to date than the one on disk
3514
- */
3515
3491
  private openClientFile;
3516
3492
  private getPosition;
3517
3493
  private getPositionInFile;
@@ -3616,7 +3592,7 @@ declare namespace ts {
3616
3592
  readDirectory(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[] | undefined, depth?: number): string[];
3617
3593
  }
3618
3594
  }
3619
- const versionMajorMinor = "5.5";
3595
+ const versionMajorMinor = "5.6";
3620
3596
  /** The version of the TypeScript compiler release */
3621
3597
  const version: string;
3622
3598
  /**
@@ -4446,7 +4422,7 @@ declare namespace ts {
4446
4422
  readonly right: Identifier;
4447
4423
  }
4448
4424
  type EntityName = Identifier | QualifiedName;
4449
- type PropertyName = Identifier | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | ComputedPropertyName | PrivateIdentifier;
4425
+ type PropertyName = Identifier | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | ComputedPropertyName | PrivateIdentifier | BigIntLiteral;
4450
4426
  type MemberName = Identifier | PrivateIdentifier;
4451
4427
  type DeclarationName = PropertyName | JsxAttributeName | StringLiteralLike | ElementAccessExpression | BindingPattern | EntityNameExpression;
4452
4428
  interface Declaration extends Node {
@@ -4797,7 +4773,7 @@ declare namespace ts {
4797
4773
  readonly kind: SyntaxKind.StringLiteral;
4798
4774
  }
4799
4775
  type StringLiteralLike = StringLiteral | NoSubstitutionTemplateLiteral;
4800
- type PropertyNameLiteral = Identifier | StringLiteralLike | NumericLiteral | JsxNamespacedName;
4776
+ type PropertyNameLiteral = Identifier | StringLiteralLike | NumericLiteral | JsxNamespacedName | BigIntLiteral;
4801
4777
  interface TemplateLiteralTypeNode extends TypeNode {
4802
4778
  kind: SyntaxKind.TemplateLiteralType;
4803
4779
  readonly head: TemplateHead;
@@ -5517,7 +5493,7 @@ declare namespace ts {
5517
5493
  interface NamespaceExport extends NamedDeclaration {
5518
5494
  readonly kind: SyntaxKind.NamespaceExport;
5519
5495
  readonly parent: ExportDeclaration;
5520
- readonly name: Identifier;
5496
+ readonly name: ModuleExportName;
5521
5497
  }
5522
5498
  interface NamespaceExportDeclaration extends DeclarationStatement, JSDocContainer {
5523
5499
  readonly kind: SyntaxKind.NamespaceExportDeclaration;
@@ -5549,7 +5525,7 @@ declare namespace ts {
5549
5525
  interface ImportSpecifier extends NamedDeclaration {
5550
5526
  readonly kind: SyntaxKind.ImportSpecifier;
5551
5527
  readonly parent: NamedImports;
5552
- readonly propertyName?: Identifier;
5528
+ readonly propertyName?: ModuleExportName;
5553
5529
  readonly name: Identifier;
5554
5530
  readonly isTypeOnly: boolean;
5555
5531
  }
@@ -5557,9 +5533,10 @@ declare namespace ts {
5557
5533
  readonly kind: SyntaxKind.ExportSpecifier;
5558
5534
  readonly parent: NamedExports;
5559
5535
  readonly isTypeOnly: boolean;
5560
- readonly propertyName?: Identifier;
5561
- readonly name: Identifier;
5536
+ readonly propertyName?: ModuleExportName;
5537
+ readonly name: ModuleExportName;
5562
5538
  }
5539
+ type ModuleExportName = Identifier | StringLiteral;
5563
5540
  type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier;
5564
5541
  type TypeOnlyCompatibleAliasDeclaration = ImportClause | ImportEqualsDeclaration | NamespaceImport | ImportOrExportSpecifier | ExportDeclaration | NamespaceExport;
5565
5542
  type TypeOnlyImportDeclaration =
@@ -6014,19 +5991,67 @@ declare namespace ts {
6014
5991
  isSourceFileFromExternalLibrary(file: SourceFile): boolean;
6015
5992
  isSourceFileDefaultLibrary(file: SourceFile): boolean;
6016
5993
  /**
6017
- * Calculates the final resolution mode for a given module reference node. This is the resolution mode explicitly provided via import
6018
- * attributes, if present, or the syntax the usage would have if emitted to JavaScript. In `--module node16` or `nodenext`, this may
6019
- * depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the input syntax of the reference. In other
6020
- * `module` modes, when overriding import attributes are not provided, this function returns `undefined`, as the result would have no
6021
- * impact on module resolution, emit, or type checking.
5994
+ * Calculates the final resolution mode for a given module reference node. This function only returns a result when module resolution
5995
+ * settings allow differing resolution between ESM imports and CJS requires, or when a mode is explicitly provided via import attributes,
5996
+ * which cause an `import` or `require` condition to be used during resolution regardless of module resolution settings. In absence of
5997
+ * overriding attributes, and in modes that support differing resolution, the result indicates the syntax the usage would emit to JavaScript.
5998
+ * Some examples:
5999
+ *
6000
+ * ```ts
6001
+ * // tsc foo.mts --module nodenext
6002
+ * import {} from "mod";
6003
+ * // Result: ESNext - the import emits as ESM due to `impliedNodeFormat` set by .mts file extension
6004
+ *
6005
+ * // tsc foo.cts --module nodenext
6006
+ * import {} from "mod";
6007
+ * // Result: CommonJS - the import emits as CJS due to `impliedNodeFormat` set by .cts file extension
6008
+ *
6009
+ * // tsc foo.ts --module preserve --moduleResolution bundler
6010
+ * import {} from "mod";
6011
+ * // Result: ESNext - the import emits as ESM due to `--module preserve` and `--moduleResolution bundler`
6012
+ * // supports conditional imports/exports
6013
+ *
6014
+ * // tsc foo.ts --module preserve --moduleResolution node10
6015
+ * import {} from "mod";
6016
+ * // Result: undefined - the import emits as ESM due to `--module preserve`, but `--moduleResolution node10`
6017
+ * // does not support conditional imports/exports
6018
+ *
6019
+ * // tsc foo.ts --module commonjs --moduleResolution node10
6020
+ * import type {} from "mod" with { "resolution-mode": "import" };
6021
+ * // Result: ESNext - conditional imports/exports always supported with "resolution-mode" attribute
6022
+ * ```
6022
6023
  */
6023
6024
  getModeForUsageLocation(file: SourceFile, usage: StringLiteralLike): ResolutionMode;
6024
6025
  /**
6025
- * Calculates the final resolution mode for an import at some index within a file's `imports` list. This is the resolution mode
6026
- * explicitly provided via import attributes, if present, or the syntax the usage would have if emitted to JavaScript. In
6027
- * `--module node16` or `nodenext`, this may depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the
6028
- * input syntax of the reference. In other `module` modes, when overriding import attributes are not provided, this function returns
6029
- * `undefined`, as the result would have no impact on module resolution, emit, or type checking.
6026
+ * Calculates the final resolution mode for an import at some index within a file's `imports` list. This function only returns a result
6027
+ * when module resolution settings allow differing resolution between ESM imports and CJS requires, or when a mode is explicitly provided
6028
+ * via import attributes, which cause an `import` or `require` condition to be used during resolution regardless of module resolution
6029
+ * settings. In absence of overriding attributes, and in modes that support differing resolution, the result indicates the syntax the
6030
+ * usage would emit to JavaScript. Some examples:
6031
+ *
6032
+ * ```ts
6033
+ * // tsc foo.mts --module nodenext
6034
+ * import {} from "mod";
6035
+ * // Result: ESNext - the import emits as ESM due to `impliedNodeFormat` set by .mts file extension
6036
+ *
6037
+ * // tsc foo.cts --module nodenext
6038
+ * import {} from "mod";
6039
+ * // Result: CommonJS - the import emits as CJS due to `impliedNodeFormat` set by .cts file extension
6040
+ *
6041
+ * // tsc foo.ts --module preserve --moduleResolution bundler
6042
+ * import {} from "mod";
6043
+ * // Result: ESNext - the import emits as ESM due to `--module preserve` and `--moduleResolution bundler`
6044
+ * // supports conditional imports/exports
6045
+ *
6046
+ * // tsc foo.ts --module preserve --moduleResolution node10
6047
+ * import {} from "mod";
6048
+ * // Result: undefined - the import emits as ESM due to `--module preserve`, but `--moduleResolution node10`
6049
+ * // does not support conditional imports/exports
6050
+ *
6051
+ * // tsc foo.ts --module commonjs --moduleResolution node10
6052
+ * import type {} from "mod" with { "resolution-mode": "import" };
6053
+ * // Result: ESNext - conditional imports/exports always supported with "resolution-mode" attribute
6054
+ * ```
6030
6055
  */
6031
6056
  getModeForResolutionAtIndex(file: SourceFile, index: number): ResolutionMode;
6032
6057
  getProjectReferences(): readonly ProjectReference[] | undefined;
@@ -6185,6 +6210,7 @@ declare namespace ts {
6185
6210
  getNumberType(): Type;
6186
6211
  getNumberLiteralType(value: number): NumberLiteralType;
6187
6212
  getBigIntType(): Type;
6213
+ getBigIntLiteralType(value: PseudoBigInt): BigIntLiteralType;
6188
6214
  getBooleanType(): Type;
6189
6215
  getFalseType(): Type;
6190
6216
  getTrueType(): Type;
@@ -6654,7 +6680,11 @@ declare namespace ts {
6654
6680
  minLength: number;
6655
6681
  /** Number of initial required or optional elements */
6656
6682
  fixedLength: number;
6657
- /** True if tuple has any rest or variadic elements */
6683
+ /**
6684
+ * True if tuple has any rest or variadic elements
6685
+ *
6686
+ * @deprecated Use `.combinedFlags & ElementFlags.Variable` instead
6687
+ */
6658
6688
  hasRestElement: boolean;
6659
6689
  combinedFlags: ElementFlags;
6660
6690
  readonly: boolean;
@@ -6978,6 +7008,7 @@ declare namespace ts {
6978
7008
  strictBindCallApply?: boolean;
6979
7009
  strictNullChecks?: boolean;
6980
7010
  strictPropertyInitialization?: boolean;
7011
+ strictBuiltinIteratorReturn?: boolean;
6981
7012
  stripInternal?: boolean;
6982
7013
  /** @deprecated */
6983
7014
  suppressExcessPropertyErrors?: boolean;
@@ -6986,6 +7017,7 @@ declare namespace ts {
6986
7017
  target?: ScriptTarget;
6987
7018
  traceResolution?: boolean;
6988
7019
  useUnknownInCatchVariables?: boolean;
7020
+ noUncheckedSideEffectImports?: boolean;
6989
7021
  resolveJsonModule?: boolean;
6990
7022
  types?: string[];
6991
7023
  /** Paths used to compute primary types search locations */
@@ -7613,20 +7645,20 @@ declare namespace ts {
7613
7645
  updateImportAttribute(node: ImportAttribute, name: ImportAttributeName, value: Expression): ImportAttribute;
7614
7646
  createNamespaceImport(name: Identifier): NamespaceImport;
7615
7647
  updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport;
7616
- createNamespaceExport(name: Identifier): NamespaceExport;
7617
- updateNamespaceExport(node: NamespaceExport, name: Identifier): NamespaceExport;
7648
+ createNamespaceExport(name: ModuleExportName): NamespaceExport;
7649
+ updateNamespaceExport(node: NamespaceExport, name: ModuleExportName): NamespaceExport;
7618
7650
  createNamedImports(elements: readonly ImportSpecifier[]): NamedImports;
7619
7651
  updateNamedImports(node: NamedImports, elements: readonly ImportSpecifier[]): NamedImports;
7620
- createImportSpecifier(isTypeOnly: boolean, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier;
7621
- updateImportSpecifier(node: ImportSpecifier, isTypeOnly: boolean, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier;
7652
+ createImportSpecifier(isTypeOnly: boolean, propertyName: ModuleExportName | undefined, name: Identifier): ImportSpecifier;
7653
+ updateImportSpecifier(node: ImportSpecifier, isTypeOnly: boolean, propertyName: ModuleExportName | undefined, name: Identifier): ImportSpecifier;
7622
7654
  createExportAssignment(modifiers: readonly ModifierLike[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment;
7623
7655
  updateExportAssignment(node: ExportAssignment, modifiers: readonly ModifierLike[] | undefined, expression: Expression): ExportAssignment;
7624
7656
  createExportDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, attributes?: ImportAttributes): ExportDeclaration;
7625
7657
  updateExportDeclaration(node: ExportDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, attributes: ImportAttributes | undefined): ExportDeclaration;
7626
7658
  createNamedExports(elements: readonly ExportSpecifier[]): NamedExports;
7627
7659
  updateNamedExports(node: NamedExports, elements: readonly ExportSpecifier[]): NamedExports;
7628
- createExportSpecifier(isTypeOnly: boolean, propertyName: string | Identifier | undefined, name: string | Identifier): ExportSpecifier;
7629
- updateExportSpecifier(node: ExportSpecifier, isTypeOnly: boolean, propertyName: Identifier | undefined, name: Identifier): ExportSpecifier;
7660
+ createExportSpecifier(isTypeOnly: boolean, propertyName: string | ModuleExportName | undefined, name: string | ModuleExportName): ExportSpecifier;
7661
+ updateExportSpecifier(node: ExportSpecifier, isTypeOnly: boolean, propertyName: ModuleExportName | undefined, name: ModuleExportName): ExportSpecifier;
7630
7662
  createExternalModuleReference(expression: Expression): ExternalModuleReference;
7631
7663
  updateExternalModuleReference(node: ExternalModuleReference, expression: Expression): ExternalModuleReference;
7632
7664
  createJSDocAllType(): JSDocAllType;
@@ -8944,6 +8976,7 @@ declare namespace ts {
8944
8976
  function isExportDeclaration(node: Node): node is ExportDeclaration;
8945
8977
  function isNamedExports(node: Node): node is NamedExports;
8946
8978
  function isExportSpecifier(node: Node): node is ExportSpecifier;
8979
+ function isModuleExportName(node: Node): node is ModuleExportName;
8947
8980
  function isMissingDeclaration(node: Node): node is MissingDeclaration;
8948
8981
  function isNotEmittedStatement(node: Node): node is NotEmittedStatement;
8949
8982
  function isExternalModuleReference(node: Node): node is ExternalModuleReference;
@@ -9379,24 +9412,43 @@ declare namespace ts {
9379
9412
  function getModeForResolutionAtIndex(file: SourceFile, index: number, compilerOptions: CompilerOptions): ResolutionMode;
9380
9413
  /**
9381
9414
  * Use `program.getModeForUsageLocation`, which retrieves the correct `compilerOptions`, instead of this function whenever possible.
9382
- * Calculates the final resolution mode for a given module reference node. This is the resolution mode explicitly provided via import
9383
- * attributes, if present, or the syntax the usage would have if emitted to JavaScript. In `--module node16` or `nodenext`, this may
9384
- * depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the input syntax of the reference. In other
9385
- * `module` modes, when overriding import attributes are not provided, this function returns `undefined`, as the result would have no
9386
- * impact on module resolution, emit, or type checking.
9415
+ * Calculates the final resolution mode for a given module reference node. This function only returns a result when module resolution
9416
+ * settings allow differing resolution between ESM imports and CJS requires, or when a mode is explicitly provided via import attributes,
9417
+ * which cause an `import` or `require` condition to be used during resolution regardless of module resolution settings. In absence of
9418
+ * overriding attributes, and in modes that support differing resolution, the result indicates the syntax the usage would emit to JavaScript.
9419
+ * Some examples:
9420
+ *
9421
+ * ```ts
9422
+ * // tsc foo.mts --module nodenext
9423
+ * import {} from "mod";
9424
+ * // Result: ESNext - the import emits as ESM due to `impliedNodeFormat` set by .mts file extension
9425
+ *
9426
+ * // tsc foo.cts --module nodenext
9427
+ * import {} from "mod";
9428
+ * // Result: CommonJS - the import emits as CJS due to `impliedNodeFormat` set by .cts file extension
9429
+ *
9430
+ * // tsc foo.ts --module preserve --moduleResolution bundler
9431
+ * import {} from "mod";
9432
+ * // Result: ESNext - the import emits as ESM due to `--module preserve` and `--moduleResolution bundler`
9433
+ * // supports conditional imports/exports
9434
+ *
9435
+ * // tsc foo.ts --module preserve --moduleResolution node10
9436
+ * import {} from "mod";
9437
+ * // Result: undefined - the import emits as ESM due to `--module preserve`, but `--moduleResolution node10`
9438
+ * // does not support conditional imports/exports
9439
+ *
9440
+ * // tsc foo.ts --module commonjs --moduleResolution node10
9441
+ * import type {} from "mod" with { "resolution-mode": "import" };
9442
+ * // Result: ESNext - conditional imports/exports always supported with "resolution-mode" attribute
9443
+ * ```
9444
+ *
9387
9445
  * @param file The file the import or import-like reference is contained within
9388
9446
  * @param usage The module reference string
9389
9447
  * @param compilerOptions The compiler options for the program that owns the file. If the file belongs to a referenced project, the compiler options
9390
9448
  * should be the options of the referenced project, not the referencing project.
9391
9449
  * @returns The final resolution mode of the import
9392
9450
  */
9393
- function getModeForUsageLocation(
9394
- file: {
9395
- impliedNodeFormat?: ResolutionMode;
9396
- },
9397
- usage: StringLiteralLike,
9398
- compilerOptions: CompilerOptions,
9399
- ): ModuleKind.CommonJS | ModuleKind.ESNext | undefined;
9451
+ function getModeForUsageLocation(file: SourceFile, usage: StringLiteralLike, compilerOptions: CompilerOptions): ResolutionMode;
9400
9452
  function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): readonly Diagnostic[];
9401
9453
  /**
9402
9454
  * A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the
@@ -9622,6 +9674,7 @@ declare namespace ts {
9622
9674
  setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
9623
9675
  /** If provided, will be used to reset existing delayed compilation */
9624
9676
  clearTimeout?(timeoutId: any): void;
9677
+ preferNonRecursiveWatch?: boolean;
9625
9678
  }
9626
9679
  interface ProgramHost<T extends BuilderProgram> {
9627
9680
  /**
@@ -10711,6 +10764,10 @@ declare namespace ts {
10711
10764
  */
10712
10765
  isIncomplete?: true;
10713
10766
  entries: CompletionEntry[];
10767
+ /**
10768
+ * Default commit characters for the completion entries.
10769
+ */
10770
+ defaultCommitCharacters?: string[];
10714
10771
  }
10715
10772
  interface CompletionEntryDataAutoImport {
10716
10773
  /**
@@ -10817,6 +10874,10 @@ declare namespace ts {
10817
10874
  * is an auto-import.
10818
10875
  */
10819
10876
  data?: CompletionEntryData;
10877
+ /**
10878
+ * If this completion entry is selected, typing a commit character will cause the entry to be accepted.
10879
+ */
10880
+ commitCharacters?: string[];
10820
10881
  }
10821
10882
  interface CompletionEntryLabelDetails {
10822
10883
  /**