typescript 5.5.0-dev.20240411 → 5.5.0-dev.20240413
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.
- package/lib/tsc.js +934 -670
- package/lib/typescript.d.ts +99 -30
- package/lib/typescript.js +1353 -895
- package/package.json +2 -2
package/lib/typescript.d.ts
CHANGED
|
@@ -2416,6 +2416,7 @@ declare namespace ts {
|
|
|
2416
2416
|
ES2020 = "es2020",
|
|
2417
2417
|
ES2021 = "es2021",
|
|
2418
2418
|
ES2022 = "es2022",
|
|
2419
|
+
ES2023 = "es2023",
|
|
2419
2420
|
ESNext = "esnext",
|
|
2420
2421
|
JSON = "json",
|
|
2421
2422
|
Latest = "esnext",
|
|
@@ -2813,7 +2814,6 @@ declare namespace ts {
|
|
|
2813
2814
|
addMissingFileRoot(fileName: NormalizedPath): void;
|
|
2814
2815
|
removeFile(info: ScriptInfo, fileExists: boolean, detachFromProject: boolean): void;
|
|
2815
2816
|
registerFileUpdate(fileName: string): void;
|
|
2816
|
-
markAsDirty(): void;
|
|
2817
2817
|
/**
|
|
2818
2818
|
* Updates set of files that contribute to this project
|
|
2819
2819
|
* @returns: true if set of files in the project stays the same and false - otherwise.
|
|
@@ -2858,10 +2858,8 @@ declare namespace ts {
|
|
|
2858
2858
|
class AutoImportProviderProject extends Project {
|
|
2859
2859
|
private hostProject;
|
|
2860
2860
|
private rootFileNames;
|
|
2861
|
-
isOrphan(): boolean;
|
|
2862
2861
|
updateGraph(): boolean;
|
|
2863
2862
|
hasRoots(): boolean;
|
|
2864
|
-
markAsDirty(): void;
|
|
2865
2863
|
getScriptFileNames(): string[];
|
|
2866
2864
|
getLanguageService(): never;
|
|
2867
2865
|
getHostForAutoImportProvider(): never;
|
|
@@ -3118,7 +3116,7 @@ declare namespace ts {
|
|
|
3118
3116
|
/**
|
|
3119
3117
|
* Open files: with value being project root path, and key being Path of the file that is open
|
|
3120
3118
|
*/
|
|
3121
|
-
readonly openFiles: Map<
|
|
3119
|
+
readonly openFiles: Map<Path, NormalizedPath | undefined>;
|
|
3122
3120
|
/**
|
|
3123
3121
|
* Map of open files that are opened without complete path but have projectRoot as current directory
|
|
3124
3122
|
*/
|
|
@@ -3187,6 +3185,13 @@ declare namespace ts {
|
|
|
3187
3185
|
private delayUpdateSourceInfoProjects;
|
|
3188
3186
|
private delayUpdateProjectsOfScriptInfoPath;
|
|
3189
3187
|
private handleDeletedFile;
|
|
3188
|
+
/**
|
|
3189
|
+
* This function goes through all the openFiles and tries to file the config file for them.
|
|
3190
|
+
* If the config file is found and it refers to existing project, it schedules the reload it for reload
|
|
3191
|
+
* If there is no existing project it just opens the configured project for the config file
|
|
3192
|
+
* shouldReloadProjectFor provides a way to filter out files to reload configured project for
|
|
3193
|
+
*/
|
|
3194
|
+
private delayReloadConfiguredProjectsForFile;
|
|
3190
3195
|
private removeProject;
|
|
3191
3196
|
private assignOrphanScriptInfosToInferredProject;
|
|
3192
3197
|
/**
|
|
@@ -3246,7 +3251,6 @@ declare namespace ts {
|
|
|
3246
3251
|
private refreshScriptInfosInDirectory;
|
|
3247
3252
|
private stopWatchingScriptInfo;
|
|
3248
3253
|
private getOrCreateScriptInfoNotOpenedByClientForNormalizedPath;
|
|
3249
|
-
private getOrCreateScriptInfoOpenedByClientForNormalizedPath;
|
|
3250
3254
|
getOrCreateScriptInfoForNormalizedPath(fileName: NormalizedPath, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, hostToQueryFileExistsOn?: {
|
|
3251
3255
|
fileExists(path: string): boolean;
|
|
3252
3256
|
}): ScriptInfo | undefined;
|
|
@@ -3268,9 +3272,7 @@ declare namespace ts {
|
|
|
3268
3272
|
/**
|
|
3269
3273
|
* This function goes through all the openFiles and tries to file the config file for them.
|
|
3270
3274
|
* If the config file is found and it refers to existing project, it reloads it either immediately
|
|
3271
|
-
* or schedules it for reload depending on delayReload option
|
|
3272
3275
|
* If there is no existing project it just opens the configured project for the config file
|
|
3273
|
-
* reloadForInfo provides a way to filter out files to reload configured project for
|
|
3274
3276
|
*/
|
|
3275
3277
|
private reloadConfiguredProjectForFiles;
|
|
3276
3278
|
/**
|
|
@@ -3320,7 +3322,6 @@ declare namespace ts {
|
|
|
3320
3322
|
hasDeferredExtension(): boolean;
|
|
3321
3323
|
private enableRequestedPluginsAsync;
|
|
3322
3324
|
private enableRequestedPluginsWorker;
|
|
3323
|
-
private enableRequestedPluginsForProjectAsync;
|
|
3324
3325
|
configurePlugin(args: protocol.ConfigurePluginRequestArguments): void;
|
|
3325
3326
|
}
|
|
3326
3327
|
function formatMessage<T extends protocol.Message>(msg: T, logger: Logger, byteLength: (s: string, encoding: BufferEncoding) => number, newLine: string): string;
|
|
@@ -5960,19 +5961,67 @@ declare namespace ts {
|
|
|
5960
5961
|
isSourceFileFromExternalLibrary(file: SourceFile): boolean;
|
|
5961
5962
|
isSourceFileDefaultLibrary(file: SourceFile): boolean;
|
|
5962
5963
|
/**
|
|
5963
|
-
* Calculates the final resolution mode for a given module reference node. This
|
|
5964
|
-
*
|
|
5965
|
-
*
|
|
5966
|
-
*
|
|
5967
|
-
*
|
|
5964
|
+
* Calculates the final resolution mode for a given module reference node. This function only returns a result when module resolution
|
|
5965
|
+
* settings allow differing resolution between ESM imports and CJS requires, or when a mode is explicitly provided via import attributes,
|
|
5966
|
+
* which cause an `import` or `require` condition to be used during resolution regardless of module resolution settings. In absence of
|
|
5967
|
+
* overriding attributes, and in modes that support differing resolution, the result indicates the syntax the usage would emit to JavaScript.
|
|
5968
|
+
* Some examples:
|
|
5969
|
+
*
|
|
5970
|
+
* ```ts
|
|
5971
|
+
* // tsc foo.mts --module nodenext
|
|
5972
|
+
* import {} from "mod";
|
|
5973
|
+
* // Result: ESNext - the import emits as ESM due to `impliedNodeFormat` set by .mts file extension
|
|
5974
|
+
*
|
|
5975
|
+
* // tsc foo.cts --module nodenext
|
|
5976
|
+
* import {} from "mod";
|
|
5977
|
+
* // Result: CommonJS - the import emits as CJS due to `impliedNodeFormat` set by .cts file extension
|
|
5978
|
+
*
|
|
5979
|
+
* // tsc foo.ts --module preserve --moduleResolution bundler
|
|
5980
|
+
* import {} from "mod";
|
|
5981
|
+
* // Result: ESNext - the import emits as ESM due to `--module preserve` and `--moduleResolution bundler`
|
|
5982
|
+
* // supports conditional imports/exports
|
|
5983
|
+
*
|
|
5984
|
+
* // tsc foo.ts --module preserve --moduleResolution node10
|
|
5985
|
+
* import {} from "mod";
|
|
5986
|
+
* // Result: undefined - the import emits as ESM due to `--module preserve`, but `--moduleResolution node10`
|
|
5987
|
+
* // does not support conditional imports/exports
|
|
5988
|
+
*
|
|
5989
|
+
* // tsc foo.ts --module commonjs --moduleResolution node10
|
|
5990
|
+
* import type {} from "mod" with { "resolution-mode": "import" };
|
|
5991
|
+
* // Result: ESNext - conditional imports/exports always supported with "resolution-mode" attribute
|
|
5992
|
+
* ```
|
|
5968
5993
|
*/
|
|
5969
5994
|
getModeForUsageLocation(file: SourceFile, usage: StringLiteralLike): ResolutionMode;
|
|
5970
5995
|
/**
|
|
5971
|
-
* Calculates the final resolution mode for an import at some index within a file's `imports` list. This
|
|
5972
|
-
*
|
|
5973
|
-
*
|
|
5974
|
-
*
|
|
5975
|
-
*
|
|
5996
|
+
* Calculates the final resolution mode for an import at some index within a file's `imports` list. This function only returns a result
|
|
5997
|
+
* when module resolution settings allow differing resolution between ESM imports and CJS requires, or when a mode is explicitly provided
|
|
5998
|
+
* via import attributes, which cause an `import` or `require` condition to be used during resolution regardless of module resolution
|
|
5999
|
+
* settings. In absence of overriding attributes, and in modes that support differing resolution, the result indicates the syntax the
|
|
6000
|
+
* usage would emit to JavaScript. Some examples:
|
|
6001
|
+
*
|
|
6002
|
+
* ```ts
|
|
6003
|
+
* // tsc foo.mts --module nodenext
|
|
6004
|
+
* import {} from "mod";
|
|
6005
|
+
* // Result: ESNext - the import emits as ESM due to `impliedNodeFormat` set by .mts file extension
|
|
6006
|
+
*
|
|
6007
|
+
* // tsc foo.cts --module nodenext
|
|
6008
|
+
* import {} from "mod";
|
|
6009
|
+
* // Result: CommonJS - the import emits as CJS due to `impliedNodeFormat` set by .cts file extension
|
|
6010
|
+
*
|
|
6011
|
+
* // tsc foo.ts --module preserve --moduleResolution bundler
|
|
6012
|
+
* import {} from "mod";
|
|
6013
|
+
* // Result: ESNext - the import emits as ESM due to `--module preserve` and `--moduleResolution bundler`
|
|
6014
|
+
* // supports conditional imports/exports
|
|
6015
|
+
*
|
|
6016
|
+
* // tsc foo.ts --module preserve --moduleResolution node10
|
|
6017
|
+
* import {} from "mod";
|
|
6018
|
+
* // Result: undefined - the import emits as ESM due to `--module preserve`, but `--moduleResolution node10`
|
|
6019
|
+
* // does not support conditional imports/exports
|
|
6020
|
+
*
|
|
6021
|
+
* // tsc foo.ts --module commonjs --moduleResolution node10
|
|
6022
|
+
* import type {} from "mod" with { "resolution-mode": "import" };
|
|
6023
|
+
* // Result: ESNext - conditional imports/exports always supported with "resolution-mode" attribute
|
|
6024
|
+
* ```
|
|
5976
6025
|
*/
|
|
5977
6026
|
getModeForResolutionAtIndex(file: SourceFile, index: number): ResolutionMode;
|
|
5978
6027
|
getProjectReferences(): readonly ProjectReference[] | undefined;
|
|
@@ -7019,6 +7068,7 @@ declare namespace ts {
|
|
|
7019
7068
|
ES2020 = 7,
|
|
7020
7069
|
ES2021 = 8,
|
|
7021
7070
|
ES2022 = 9,
|
|
7071
|
+
ES2023 = 10,
|
|
7022
7072
|
ESNext = 99,
|
|
7023
7073
|
JSON = 100,
|
|
7024
7074
|
Latest = 99,
|
|
@@ -9323,24 +9373,43 @@ declare namespace ts {
|
|
|
9323
9373
|
function getModeForResolutionAtIndex(file: SourceFile, index: number, compilerOptions: CompilerOptions): ResolutionMode;
|
|
9324
9374
|
/**
|
|
9325
9375
|
* Use `program.getModeForUsageLocation`, which retrieves the correct `compilerOptions`, instead of this function whenever possible.
|
|
9326
|
-
* Calculates the final resolution mode for a given module reference node. This
|
|
9327
|
-
*
|
|
9328
|
-
*
|
|
9329
|
-
*
|
|
9330
|
-
*
|
|
9376
|
+
* Calculates the final resolution mode for a given module reference node. This function only returns a result when module resolution
|
|
9377
|
+
* settings allow differing resolution between ESM imports and CJS requires, or when a mode is explicitly provided via import attributes,
|
|
9378
|
+
* which cause an `import` or `require` condition to be used during resolution regardless of module resolution settings. In absence of
|
|
9379
|
+
* overriding attributes, and in modes that support differing resolution, the result indicates the syntax the usage would emit to JavaScript.
|
|
9380
|
+
* Some examples:
|
|
9381
|
+
*
|
|
9382
|
+
* ```ts
|
|
9383
|
+
* // tsc foo.mts --module nodenext
|
|
9384
|
+
* import {} from "mod";
|
|
9385
|
+
* // Result: ESNext - the import emits as ESM due to `impliedNodeFormat` set by .mts file extension
|
|
9386
|
+
*
|
|
9387
|
+
* // tsc foo.cts --module nodenext
|
|
9388
|
+
* import {} from "mod";
|
|
9389
|
+
* // Result: CommonJS - the import emits as CJS due to `impliedNodeFormat` set by .cts file extension
|
|
9390
|
+
*
|
|
9391
|
+
* // tsc foo.ts --module preserve --moduleResolution bundler
|
|
9392
|
+
* import {} from "mod";
|
|
9393
|
+
* // Result: ESNext - the import emits as ESM due to `--module preserve` and `--moduleResolution bundler`
|
|
9394
|
+
* // supports conditional imports/exports
|
|
9395
|
+
*
|
|
9396
|
+
* // tsc foo.ts --module preserve --moduleResolution node10
|
|
9397
|
+
* import {} from "mod";
|
|
9398
|
+
* // Result: undefined - the import emits as ESM due to `--module preserve`, but `--moduleResolution node10`
|
|
9399
|
+
* // does not support conditional imports/exports
|
|
9400
|
+
*
|
|
9401
|
+
* // tsc foo.ts --module commonjs --moduleResolution node10
|
|
9402
|
+
* import type {} from "mod" with { "resolution-mode": "import" };
|
|
9403
|
+
* // Result: ESNext - conditional imports/exports always supported with "resolution-mode" attribute
|
|
9404
|
+
* ```
|
|
9405
|
+
*
|
|
9331
9406
|
* @param file The file the import or import-like reference is contained within
|
|
9332
9407
|
* @param usage The module reference string
|
|
9333
9408
|
* @param compilerOptions The compiler options for the program that owns the file. If the file belongs to a referenced project, the compiler options
|
|
9334
9409
|
* should be the options of the referenced project, not the referencing project.
|
|
9335
9410
|
* @returns The final resolution mode of the import
|
|
9336
9411
|
*/
|
|
9337
|
-
function getModeForUsageLocation(
|
|
9338
|
-
file: {
|
|
9339
|
-
impliedNodeFormat?: ResolutionMode;
|
|
9340
|
-
},
|
|
9341
|
-
usage: StringLiteralLike,
|
|
9342
|
-
compilerOptions: CompilerOptions,
|
|
9343
|
-
): ModuleKind.CommonJS | ModuleKind.ESNext | undefined;
|
|
9412
|
+
function getModeForUsageLocation(file: SourceFile, usage: StringLiteralLike, compilerOptions: CompilerOptions): ResolutionMode;
|
|
9344
9413
|
function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): readonly Diagnostic[];
|
|
9345
9414
|
/**
|
|
9346
9415
|
* A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the
|