typescript 5.5.0-dev.20240603 → 5.5.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.
- package/lib/tsc.js +204 -252
- package/lib/typescript.d.ts +22 -89
- package/lib/typescript.js +284 -371
- package/package.json +2 -2
package/lib/typescript.d.ts
CHANGED
|
@@ -6014,67 +6014,19 @@ declare namespace ts {
|
|
|
6014
6014
|
isSourceFileFromExternalLibrary(file: SourceFile): boolean;
|
|
6015
6015
|
isSourceFileDefaultLibrary(file: SourceFile): boolean;
|
|
6016
6016
|
/**
|
|
6017
|
-
* Calculates the final resolution mode for a given module reference node. This
|
|
6018
|
-
*
|
|
6019
|
-
*
|
|
6020
|
-
*
|
|
6021
|
-
*
|
|
6022
|
-
*
|
|
6023
|
-
* ```ts
|
|
6024
|
-
* // tsc foo.mts --module nodenext
|
|
6025
|
-
* import {} from "mod";
|
|
6026
|
-
* // Result: ESNext - the import emits as ESM due to `impliedNodeFormat` set by .mts file extension
|
|
6027
|
-
*
|
|
6028
|
-
* // tsc foo.cts --module nodenext
|
|
6029
|
-
* import {} from "mod";
|
|
6030
|
-
* // Result: CommonJS - the import emits as CJS due to `impliedNodeFormat` set by .cts file extension
|
|
6031
|
-
*
|
|
6032
|
-
* // tsc foo.ts --module preserve --moduleResolution bundler
|
|
6033
|
-
* import {} from "mod";
|
|
6034
|
-
* // Result: ESNext - the import emits as ESM due to `--module preserve` and `--moduleResolution bundler`
|
|
6035
|
-
* // supports conditional imports/exports
|
|
6036
|
-
*
|
|
6037
|
-
* // tsc foo.ts --module preserve --moduleResolution node10
|
|
6038
|
-
* import {} from "mod";
|
|
6039
|
-
* // Result: undefined - the import emits as ESM due to `--module preserve`, but `--moduleResolution node10`
|
|
6040
|
-
* // does not support conditional imports/exports
|
|
6041
|
-
*
|
|
6042
|
-
* // tsc foo.ts --module commonjs --moduleResolution node10
|
|
6043
|
-
* import type {} from "mod" with { "resolution-mode": "import" };
|
|
6044
|
-
* // Result: ESNext - conditional imports/exports always supported with "resolution-mode" attribute
|
|
6045
|
-
* ```
|
|
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.
|
|
6046
6022
|
*/
|
|
6047
6023
|
getModeForUsageLocation(file: SourceFile, usage: StringLiteralLike): ResolutionMode;
|
|
6048
6024
|
/**
|
|
6049
|
-
* Calculates the final resolution mode for an import at some index within a file's `imports` list. This
|
|
6050
|
-
*
|
|
6051
|
-
*
|
|
6052
|
-
*
|
|
6053
|
-
*
|
|
6054
|
-
*
|
|
6055
|
-
* ```ts
|
|
6056
|
-
* // tsc foo.mts --module nodenext
|
|
6057
|
-
* import {} from "mod";
|
|
6058
|
-
* // Result: ESNext - the import emits as ESM due to `impliedNodeFormat` set by .mts file extension
|
|
6059
|
-
*
|
|
6060
|
-
* // tsc foo.cts --module nodenext
|
|
6061
|
-
* import {} from "mod";
|
|
6062
|
-
* // Result: CommonJS - the import emits as CJS due to `impliedNodeFormat` set by .cts file extension
|
|
6063
|
-
*
|
|
6064
|
-
* // tsc foo.ts --module preserve --moduleResolution bundler
|
|
6065
|
-
* import {} from "mod";
|
|
6066
|
-
* // Result: ESNext - the import emits as ESM due to `--module preserve` and `--moduleResolution bundler`
|
|
6067
|
-
* // supports conditional imports/exports
|
|
6068
|
-
*
|
|
6069
|
-
* // tsc foo.ts --module preserve --moduleResolution node10
|
|
6070
|
-
* import {} from "mod";
|
|
6071
|
-
* // Result: undefined - the import emits as ESM due to `--module preserve`, but `--moduleResolution node10`
|
|
6072
|
-
* // does not support conditional imports/exports
|
|
6073
|
-
*
|
|
6074
|
-
* // tsc foo.ts --module commonjs --moduleResolution node10
|
|
6075
|
-
* import type {} from "mod" with { "resolution-mode": "import" };
|
|
6076
|
-
* // Result: ESNext - conditional imports/exports always supported with "resolution-mode" attribute
|
|
6077
|
-
* ```
|
|
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.
|
|
6078
6030
|
*/
|
|
6079
6031
|
getModeForResolutionAtIndex(file: SourceFile, index: number): ResolutionMode;
|
|
6080
6032
|
getProjectReferences(): readonly ProjectReference[] | undefined;
|
|
@@ -9427,43 +9379,24 @@ declare namespace ts {
|
|
|
9427
9379
|
function getModeForResolutionAtIndex(file: SourceFile, index: number, compilerOptions: CompilerOptions): ResolutionMode;
|
|
9428
9380
|
/**
|
|
9429
9381
|
* Use `program.getModeForUsageLocation`, which retrieves the correct `compilerOptions`, instead of this function whenever possible.
|
|
9430
|
-
* Calculates the final resolution mode for a given module reference node. This
|
|
9431
|
-
*
|
|
9432
|
-
*
|
|
9433
|
-
*
|
|
9434
|
-
*
|
|
9435
|
-
*
|
|
9436
|
-
* ```ts
|
|
9437
|
-
* // tsc foo.mts --module nodenext
|
|
9438
|
-
* import {} from "mod";
|
|
9439
|
-
* // Result: ESNext - the import emits as ESM due to `impliedNodeFormat` set by .mts file extension
|
|
9440
|
-
*
|
|
9441
|
-
* // tsc foo.cts --module nodenext
|
|
9442
|
-
* import {} from "mod";
|
|
9443
|
-
* // Result: CommonJS - the import emits as CJS due to `impliedNodeFormat` set by .cts file extension
|
|
9444
|
-
*
|
|
9445
|
-
* // tsc foo.ts --module preserve --moduleResolution bundler
|
|
9446
|
-
* import {} from "mod";
|
|
9447
|
-
* // Result: ESNext - the import emits as ESM due to `--module preserve` and `--moduleResolution bundler`
|
|
9448
|
-
* // supports conditional imports/exports
|
|
9449
|
-
*
|
|
9450
|
-
* // tsc foo.ts --module preserve --moduleResolution node10
|
|
9451
|
-
* import {} from "mod";
|
|
9452
|
-
* // Result: undefined - the import emits as ESM due to `--module preserve`, but `--moduleResolution node10`
|
|
9453
|
-
* // does not support conditional imports/exports
|
|
9454
|
-
*
|
|
9455
|
-
* // tsc foo.ts --module commonjs --moduleResolution node10
|
|
9456
|
-
* import type {} from "mod" with { "resolution-mode": "import" };
|
|
9457
|
-
* // Result: ESNext - conditional imports/exports always supported with "resolution-mode" attribute
|
|
9458
|
-
* ```
|
|
9459
|
-
*
|
|
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.
|
|
9460
9387
|
* @param file The file the import or import-like reference is contained within
|
|
9461
9388
|
* @param usage The module reference string
|
|
9462
9389
|
* @param compilerOptions The compiler options for the program that owns the file. If the file belongs to a referenced project, the compiler options
|
|
9463
9390
|
* should be the options of the referenced project, not the referencing project.
|
|
9464
9391
|
* @returns The final resolution mode of the import
|
|
9465
9392
|
*/
|
|
9466
|
-
function getModeForUsageLocation(
|
|
9393
|
+
function getModeForUsageLocation(
|
|
9394
|
+
file: {
|
|
9395
|
+
impliedNodeFormat?: ResolutionMode;
|
|
9396
|
+
},
|
|
9397
|
+
usage: StringLiteralLike,
|
|
9398
|
+
compilerOptions: CompilerOptions,
|
|
9399
|
+
): ModuleKind.CommonJS | ModuleKind.ESNext | undefined;
|
|
9467
9400
|
function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): readonly Diagnostic[];
|
|
9468
9401
|
/**
|
|
9469
9402
|
* A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the
|