@typescript-deploys/pr-build 5.4.0-pr-56626-8 → 5.4.0-pr-56681-3
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 +225 -66
- package/lib/tsserver.js +315 -89
- package/lib/typescript.d.ts +25 -2
- package/lib/typescript.js +312 -91
- package/lib/typingsInstaller.js +104 -16
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.4";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20231205`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -7353,6 +7353,9 @@ var Diagnostics = {
|
|
|
7353
7353
|
Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
|
|
7354
7354
|
Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
|
|
7355
7355
|
Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
|
|
7356
|
+
Specify_how_files_are_determined_to_be_ECMAScript_modules_or_CommonJS_modules: diag(6805, 3 /* Message */, "Specify_how_files_are_determined_to_be_ECMAScript_modules_or_CommonJS_modules_6805", "Specify how files are determined to be ECMAScript modules or CommonJS modules."),
|
|
7357
|
+
Specify_the_target_runtime_s_rules_for_ESM_CommonJS_interoperation: diag(6806, 3 /* Message */, "Specify_the_target_runtime_s_rules_for_ESM_CommonJS_interoperation_6806", "Specify the target runtime's rules for ESM-CommonJS interoperation."),
|
|
7358
|
+
Specify_defaults_for_module_options_suited_for_common_runtimes_and_bundlers: diag(6807, 3 /* Message */, "Specify_defaults_for_module_options_suited_for_common_runtimes_and_bundlers_6807", "Specify defaults for module options suited for common runtimes and bundlers."),
|
|
7356
7359
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
7357
7360
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
|
7358
7361
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
|
@@ -7385,6 +7388,8 @@ var Diagnostics = {
|
|
|
7385
7388
|
Compiles_the_current_project_with_additional_settings: diag(6929, 3 /* Message */, "Compiles_the_current_project_with_additional_settings_6929", "Compiles the current project, with additional settings."),
|
|
7386
7389
|
true_for_ES2022_and_above_including_ESNext: diag(6930, 3 /* Message */, "true_for_ES2022_and_above_including_ESNext_6930", "`true` for ES2022 and above, including ESNext."),
|
|
7387
7390
|
List_of_file_name_suffixes_to_search_when_resolving_a_module: diag(6931, 1 /* Error */, "List_of_file_name_suffixes_to_search_when_resolving_a_module_6931", "List of file name suffixes to search when resolving a module."),
|
|
7391
|
+
node16_when_module_is_node16_nodenext_when_module_is_nodenext_none_otherwise: diag(6932, 3 /* Message */, "node16_when_module_is_node16_nodenext_when_module_is_nodenext_none_otherwise_6932", "'node16' when 'module' is 'node16'; 'nodenext' when 'module' is 'nodenext'; 'none' otherwise."),
|
|
7392
|
+
node16_when_module_is_node16_nodenext_when_module_is_nodenext_babel_otherwise: diag(6933, 3 /* Message */, "node16_when_module_is_node16_nodenext_when_module_is_nodenext_babel_otherwise_6933", "'node16' when 'module' is 'node16'; 'nodenext' when 'module' is 'nodenext'; 'babel' otherwise."),
|
|
7388
7393
|
Variable_0_implicitly_has_an_1_type: diag(7005, 1 /* Error */, "Variable_0_implicitly_has_an_1_type_7005", "Variable '{0}' implicitly has an '{1}' type."),
|
|
7389
7394
|
Parameter_0_implicitly_has_an_1_type: diag(7006, 1 /* Error */, "Parameter_0_implicitly_has_an_1_type_7006", "Parameter '{0}' implicitly has an '{1}' type."),
|
|
7390
7395
|
Member_0_implicitly_has_an_1_type: diag(7008, 1 /* Error */, "Member_0_implicitly_has_an_1_type_7008", "Member '{0}' implicitly has an '{1}' type."),
|
|
@@ -16359,11 +16364,46 @@ function getEmitScriptTarget(compilerOptions) {
|
|
|
16359
16364
|
return compilerOptions.target ?? (compilerOptions.module === 100 /* Node16 */ && 9 /* ES2022 */ || compilerOptions.module === 199 /* NodeNext */ && 99 /* ESNext */ || 1 /* ES5 */);
|
|
16360
16365
|
}
|
|
16361
16366
|
function getEmitModuleKind(compilerOptions) {
|
|
16367
|
+
if (typeof compilerOptions.module === "object" && compilerOptions.module.emit !== void 0) {
|
|
16368
|
+
return compilerOptions.module.emit;
|
|
16369
|
+
}
|
|
16362
16370
|
return typeof compilerOptions.module === "number" ? compilerOptions.module : getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */ ? 5 /* ES2015 */ : 1 /* CommonJS */;
|
|
16363
16371
|
}
|
|
16364
16372
|
function emitModuleKindIsNonNodeESM(moduleKind) {
|
|
16365
16373
|
return moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */;
|
|
16366
16374
|
}
|
|
16375
|
+
function getModulePreset(compilerOptions) {
|
|
16376
|
+
if (typeof compilerOptions.module === "object") {
|
|
16377
|
+
return compilerOptions.module.preset;
|
|
16378
|
+
}
|
|
16379
|
+
return compilerOptions.module;
|
|
16380
|
+
}
|
|
16381
|
+
function getModuleFormatDetectionKind(compilerOptions) {
|
|
16382
|
+
if (typeof compilerOptions.module === "object" && compilerOptions.module.formatDetection !== void 0) {
|
|
16383
|
+
return compilerOptions.module.formatDetection;
|
|
16384
|
+
}
|
|
16385
|
+
switch (getModulePreset(compilerOptions)) {
|
|
16386
|
+
case 100 /* Node16 */:
|
|
16387
|
+
return 100 /* Node16 */;
|
|
16388
|
+
case 199 /* NodeNext */:
|
|
16389
|
+
return 199 /* NodeNext */;
|
|
16390
|
+
default:
|
|
16391
|
+
return 0 /* None */;
|
|
16392
|
+
}
|
|
16393
|
+
}
|
|
16394
|
+
function getModuleFormatInteropKind(compilerOptions) {
|
|
16395
|
+
if (typeof compilerOptions.module === "object" && compilerOptions.module.formatInterop !== void 0) {
|
|
16396
|
+
return compilerOptions.module.formatInterop;
|
|
16397
|
+
}
|
|
16398
|
+
switch (getModulePreset(compilerOptions)) {
|
|
16399
|
+
case 100 /* Node16 */:
|
|
16400
|
+
return 100 /* Node16 */;
|
|
16401
|
+
case 199 /* NodeNext */:
|
|
16402
|
+
return 199 /* NodeNext */;
|
|
16403
|
+
default:
|
|
16404
|
+
return 1 /* Babel */;
|
|
16405
|
+
}
|
|
16406
|
+
}
|
|
16367
16407
|
function getEmitModuleResolutionKind(compilerOptions) {
|
|
16368
16408
|
let moduleResolution = compilerOptions.moduleResolution;
|
|
16369
16409
|
if (moduleResolution === void 0) {
|
|
@@ -33128,6 +33168,8 @@ var Parser;
|
|
|
33128
33168
|
break;
|
|
33129
33169
|
case "template":
|
|
33130
33170
|
return parseTemplateTag(start2, tagName, indent2, indentText);
|
|
33171
|
+
case "this":
|
|
33172
|
+
return parseThisTag(start2, tagName, indent2, indentText);
|
|
33131
33173
|
default:
|
|
33132
33174
|
return false;
|
|
33133
33175
|
}
|
|
@@ -34192,23 +34234,79 @@ var targetOptionDeclaration = {
|
|
|
34192
34234
|
description: Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
|
|
34193
34235
|
defaultValueDescription: 1 /* ES5 */
|
|
34194
34236
|
};
|
|
34237
|
+
var moduleKindMap = new Map(Object.entries({
|
|
34238
|
+
none: 0 /* None */,
|
|
34239
|
+
commonjs: 1 /* CommonJS */,
|
|
34240
|
+
amd: 2 /* AMD */,
|
|
34241
|
+
system: 4 /* System */,
|
|
34242
|
+
umd: 3 /* UMD */,
|
|
34243
|
+
es6: 5 /* ES2015 */,
|
|
34244
|
+
es2015: 5 /* ES2015 */,
|
|
34245
|
+
es2020: 6 /* ES2020 */,
|
|
34246
|
+
es2022: 7 /* ES2022 */,
|
|
34247
|
+
esnext: 99 /* ESNext */,
|
|
34248
|
+
node16: 100 /* Node16 */,
|
|
34249
|
+
nodenext: 199 /* NodeNext */
|
|
34250
|
+
}));
|
|
34251
|
+
var moduleSubOptionDeclarations = [
|
|
34252
|
+
{
|
|
34253
|
+
name: "preset",
|
|
34254
|
+
type: moduleKindMap,
|
|
34255
|
+
affectsSourceFile: true,
|
|
34256
|
+
affectsBuildInfo: true,
|
|
34257
|
+
affectsEmit: true,
|
|
34258
|
+
affectsSemanticDiagnostics: true,
|
|
34259
|
+
category: Diagnostics.Modules,
|
|
34260
|
+
description: Diagnostics.Specify_defaults_for_module_options_suited_for_common_runtimes_and_bundlers,
|
|
34261
|
+
defaultValueDescription: void 0,
|
|
34262
|
+
getParentOption: getModuleOptionDeclaration
|
|
34263
|
+
},
|
|
34264
|
+
{
|
|
34265
|
+
name: "formatDetection",
|
|
34266
|
+
type: new Map(Object.entries({
|
|
34267
|
+
none: 0 /* None */,
|
|
34268
|
+
bundler: 1 /* Bundler */,
|
|
34269
|
+
node16: 100 /* Node16 */,
|
|
34270
|
+
nodenext: 199 /* NodeNext */
|
|
34271
|
+
})),
|
|
34272
|
+
affectsModuleResolution: true,
|
|
34273
|
+
affectsSemanticDiagnostics: true,
|
|
34274
|
+
affectsEmit: true,
|
|
34275
|
+
category: Diagnostics.Modules,
|
|
34276
|
+
description: Diagnostics.Specify_how_files_are_determined_to_be_ECMAScript_modules_or_CommonJS_modules,
|
|
34277
|
+
defaultValueDescription: Diagnostics.node16_when_module_is_node16_nodenext_when_module_is_nodenext_none_otherwise,
|
|
34278
|
+
getParentOption: getModuleOptionDeclaration
|
|
34279
|
+
},
|
|
34280
|
+
{
|
|
34281
|
+
name: "formatInterop",
|
|
34282
|
+
type: new Map(Object.entries({
|
|
34283
|
+
babel: 1 /* Babel */,
|
|
34284
|
+
bundlernode: 2 /* BundlerNode */,
|
|
34285
|
+
node16: 100 /* Node16 */,
|
|
34286
|
+
nodenext: 199 /* NodeNext */
|
|
34287
|
+
})),
|
|
34288
|
+
affectsSemanticDiagnostics: true,
|
|
34289
|
+
category: Diagnostics.Modules,
|
|
34290
|
+
description: Diagnostics.Specify_the_target_runtime_s_rules_for_ESM_CommonJS_interoperation,
|
|
34291
|
+
defaultValueDescription: Diagnostics.node16_when_module_is_node16_nodenext_when_module_is_nodenext_babel_otherwise,
|
|
34292
|
+
getParentOption: getModuleOptionDeclaration
|
|
34293
|
+
},
|
|
34294
|
+
{
|
|
34295
|
+
name: "emit",
|
|
34296
|
+
type: moduleKindMap,
|
|
34297
|
+
affectsEmit: true,
|
|
34298
|
+
category: Diagnostics.Modules,
|
|
34299
|
+
description: Diagnostics.Specify_what_module_code_is_generated,
|
|
34300
|
+
defaultValueDescription: void 0,
|
|
34301
|
+
getParentOption: getModuleOptionDeclaration
|
|
34302
|
+
}
|
|
34303
|
+
];
|
|
34195
34304
|
var moduleOptionDeclaration = {
|
|
34196
34305
|
name: "module",
|
|
34197
34306
|
shortName: "m",
|
|
34198
|
-
type:
|
|
34199
|
-
|
|
34200
|
-
|
|
34201
|
-
amd: 2 /* AMD */,
|
|
34202
|
-
system: 4 /* System */,
|
|
34203
|
-
umd: 3 /* UMD */,
|
|
34204
|
-
es6: 5 /* ES2015 */,
|
|
34205
|
-
es2015: 5 /* ES2015 */,
|
|
34206
|
-
es2020: 6 /* ES2020 */,
|
|
34207
|
-
es2022: 7 /* ES2022 */,
|
|
34208
|
-
esnext: 99 /* ESNext */,
|
|
34209
|
-
node16: 100 /* Node16 */,
|
|
34210
|
-
nodenext: 199 /* NodeNext */
|
|
34211
|
-
})),
|
|
34307
|
+
type: "objectOrShorthand",
|
|
34308
|
+
shorthandType: moduleKindMap,
|
|
34309
|
+
elementOptions: commandLineOptionsToMap(moduleSubOptionDeclarations),
|
|
34212
34310
|
affectsSourceFile: true,
|
|
34213
34311
|
affectsModuleResolution: true,
|
|
34214
34312
|
affectsEmit: true,
|
|
@@ -34219,6 +34317,9 @@ var moduleOptionDeclaration = {
|
|
|
34219
34317
|
description: Diagnostics.Specify_what_module_code_is_generated,
|
|
34220
34318
|
defaultValueDescription: void 0
|
|
34221
34319
|
};
|
|
34320
|
+
function getModuleOptionDeclaration() {
|
|
34321
|
+
return moduleOptionDeclaration;
|
|
34322
|
+
}
|
|
34222
34323
|
var commandOptionsWithoutBuild = [
|
|
34223
34324
|
// CommandLine only options
|
|
34224
34325
|
{
|
|
@@ -34285,6 +34386,9 @@ var commandOptionsWithoutBuild = [
|
|
|
34285
34386
|
// Basic
|
|
34286
34387
|
targetOptionDeclaration,
|
|
34287
34388
|
moduleOptionDeclaration,
|
|
34389
|
+
// HEAD
|
|
34390
|
+
//
|
|
34391
|
+
// parent of 19e60f1a19 (Fix showConfig)
|
|
34288
34392
|
{
|
|
34289
34393
|
name: "lib",
|
|
34290
34394
|
type: "list",
|
|
@@ -35281,10 +35385,16 @@ function createOptionNameMap(optionDeclarations2) {
|
|
|
35281
35385
|
const optionsNameMap = /* @__PURE__ */ new Map();
|
|
35282
35386
|
const shortOptionNames = /* @__PURE__ */ new Map();
|
|
35283
35387
|
forEach(optionDeclarations2, (option) => {
|
|
35284
|
-
|
|
35388
|
+
const lowerCaseName = option.name.toLowerCase();
|
|
35389
|
+
optionsNameMap.set(lowerCaseName, option);
|
|
35285
35390
|
if (option.shortName) {
|
|
35286
35391
|
shortOptionNames.set(option.shortName, option.name);
|
|
35287
35392
|
}
|
|
35393
|
+
if (option.type === "objectOrShorthand") {
|
|
35394
|
+
forEachEntry(option.elementOptions, (subOption, subOptionName) => {
|
|
35395
|
+
optionsNameMap.set(`${lowerCaseName}.${subOptionName.toLowerCase()}`, subOption);
|
|
35396
|
+
});
|
|
35397
|
+
}
|
|
35288
35398
|
});
|
|
35289
35399
|
return { optionsNameMap, shortOptionNames };
|
|
35290
35400
|
}
|
|
@@ -35305,7 +35415,8 @@ var defaultInitCompilerOptions = {
|
|
|
35305
35415
|
skipLibCheck: true
|
|
35306
35416
|
};
|
|
35307
35417
|
function createDiagnosticForInvalidCustomType(opt, createDiagnostic) {
|
|
35308
|
-
const
|
|
35418
|
+
const type = opt.type === "objectOrShorthand" ? opt.shorthandType : opt.type;
|
|
35419
|
+
const namesOfType = arrayFrom(type.keys());
|
|
35309
35420
|
const stringNames = (opt.deprecatedKeys ? namesOfType.filter((k) => !opt.deprecatedKeys.has(k)) : namesOfType).map((key) => `'${key}'`).join(", ");
|
|
35310
35421
|
return createDiagnostic(Diagnostics.Argument_for_0_option_must_be_Colon_1, `--${opt.name}`, stringNames);
|
|
35311
35422
|
}
|
|
@@ -35428,6 +35539,7 @@ function parseCommandLineWorker(diagnostics, commandLine, readFile) {
|
|
|
35428
35539
|
}
|
|
35429
35540
|
}
|
|
35430
35541
|
function parseOptionValue(args, i, diagnostics, opt, options, errors) {
|
|
35542
|
+
var _a;
|
|
35431
35543
|
if (opt.isTSConfigOnly) {
|
|
35432
35544
|
const optValue = args[i];
|
|
35433
35545
|
if (optValue === "null") {
|
|
@@ -35456,40 +35568,46 @@ function parseOptionValue(args, i, diagnostics, opt, options, errors) {
|
|
|
35456
35568
|
if (!args[i] && opt.type !== "boolean") {
|
|
35457
35569
|
errors.push(createCompilerDiagnostic(diagnostics.optionTypeMismatchDiagnostic, opt.name, getCompilerOptionValueTypeString(opt)));
|
|
35458
35570
|
}
|
|
35571
|
+
const parentOption = (_a = opt.getParentOption) == null ? void 0 : _a.call(opt);
|
|
35572
|
+
const [base = {}, name] = parentOption ? [options[parentOption.name], opt.name] : [options, opt.name];
|
|
35573
|
+
if (parentOption) {
|
|
35574
|
+
options[parentOption.name] = base;
|
|
35575
|
+
}
|
|
35459
35576
|
if (args[i] !== "null") {
|
|
35460
|
-
switch (opt.type) {
|
|
35577
|
+
switch (opt.type === "objectOrShorthand" ? opt.shorthandType : opt.type) {
|
|
35461
35578
|
case "number":
|
|
35462
|
-
|
|
35579
|
+
base[name] = validateJsonOptionValue(opt, parseInt(args[i]), errors);
|
|
35463
35580
|
i++;
|
|
35464
35581
|
break;
|
|
35465
35582
|
case "boolean":
|
|
35466
35583
|
const optValue = args[i];
|
|
35467
|
-
|
|
35584
|
+
base[name] = validateJsonOptionValue(opt, optValue !== "false", errors);
|
|
35468
35585
|
if (optValue === "false" || optValue === "true") {
|
|
35469
35586
|
i++;
|
|
35470
35587
|
}
|
|
35471
35588
|
break;
|
|
35472
35589
|
case "string":
|
|
35473
|
-
|
|
35590
|
+
base[name] = validateJsonOptionValue(opt, args[i] || "", errors);
|
|
35474
35591
|
i++;
|
|
35475
35592
|
break;
|
|
35476
35593
|
case "list":
|
|
35477
35594
|
const result = parseListTypeOption(opt, args[i], errors);
|
|
35478
|
-
|
|
35595
|
+
base[name] = result || [];
|
|
35479
35596
|
if (result) {
|
|
35480
35597
|
i++;
|
|
35481
35598
|
}
|
|
35482
35599
|
break;
|
|
35600
|
+
case "object":
|
|
35483
35601
|
case "listOrElement":
|
|
35484
|
-
Debug.fail("listOrElement not supported here");
|
|
35602
|
+
Debug.fail("listOrElement, object, and objectOrShorthand not supported here");
|
|
35485
35603
|
break;
|
|
35486
35604
|
default:
|
|
35487
|
-
|
|
35605
|
+
base[name] = parseCustomTypeOption(opt, args[i], errors);
|
|
35488
35606
|
i++;
|
|
35489
35607
|
break;
|
|
35490
35608
|
}
|
|
35491
35609
|
} else {
|
|
35492
|
-
|
|
35610
|
+
base[name] = void 0;
|
|
35493
35611
|
i++;
|
|
35494
35612
|
}
|
|
35495
35613
|
}
|
|
@@ -35855,17 +35973,23 @@ function isCompilerOptionsValue(option, value) {
|
|
|
35855
35973
|
if (option) {
|
|
35856
35974
|
if (isNullOrUndefined(value))
|
|
35857
35975
|
return !option.disallowNullOrUndefined;
|
|
35858
|
-
if (option.type === "list") {
|
|
35859
|
-
return isArray(value);
|
|
35860
|
-
}
|
|
35861
35976
|
if (option.type === "listOrElement") {
|
|
35862
|
-
return
|
|
35977
|
+
return isCompilerOptionsValueWorker("list", value) || isCompilerOptionsValue(option.element, value);
|
|
35863
35978
|
}
|
|
35864
|
-
|
|
35865
|
-
|
|
35979
|
+
if (option.type === "objectOrShorthand") {
|
|
35980
|
+
return isCompilerOptionsValueWorker(option.shorthandType, value) || typeof value === "object";
|
|
35981
|
+
}
|
|
35982
|
+
return isCompilerOptionsValueWorker(option.type, value);
|
|
35866
35983
|
}
|
|
35867
35984
|
return false;
|
|
35868
35985
|
}
|
|
35986
|
+
function isCompilerOptionsValueWorker(type, value) {
|
|
35987
|
+
if (type === "list") {
|
|
35988
|
+
return isArray(value);
|
|
35989
|
+
}
|
|
35990
|
+
const expectedType = isString(type) ? type : "string";
|
|
35991
|
+
return typeof value === expectedType;
|
|
35992
|
+
}
|
|
35869
35993
|
function convertToTSConfig(configParseResult, configFileName, host) {
|
|
35870
35994
|
var _a, _b, _c;
|
|
35871
35995
|
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames);
|
|
@@ -35949,6 +36073,8 @@ function getCustomTypeMapOfCommandLineOption(optionDefinition) {
|
|
|
35949
36073
|
case "list":
|
|
35950
36074
|
case "listOrElement":
|
|
35951
36075
|
return getCustomTypeMapOfCommandLineOption(optionDefinition.element);
|
|
36076
|
+
case "objectOrShorthand":
|
|
36077
|
+
return typeof optionDefinition.shorthandType === "object" ? optionDefinition.shorthandType : void 0;
|
|
35952
36078
|
default:
|
|
35953
36079
|
return optionDefinition.type;
|
|
35954
36080
|
}
|
|
@@ -36447,6 +36573,7 @@ function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileNa
|
|
|
36447
36573
|
const options = getDefaultCompilerOptions(configFileName);
|
|
36448
36574
|
let typeAcquisition;
|
|
36449
36575
|
let watchOptions;
|
|
36576
|
+
let moduleOption;
|
|
36450
36577
|
let extendedConfigPath;
|
|
36451
36578
|
let rootCompilerOptions;
|
|
36452
36579
|
const rootOptions = getTsconfigRootOptionsMap();
|
|
@@ -36474,6 +36601,8 @@ function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileNa
|
|
|
36474
36601
|
currentOption = watchOptions ?? (watchOptions = {});
|
|
36475
36602
|
else if (parentOption === typeAcquisitionDeclaration)
|
|
36476
36603
|
currentOption = typeAcquisition ?? (typeAcquisition = getDefaultTypeAcquisition(configFileName));
|
|
36604
|
+
else if (parentOption === moduleOptionDeclaration)
|
|
36605
|
+
currentOption = moduleOption ?? (moduleOption = {});
|
|
36477
36606
|
else
|
|
36478
36607
|
Debug.fail("Unknown option");
|
|
36479
36608
|
currentOption[option.name] = value;
|
|
@@ -36635,6 +36764,16 @@ function convertJsonOption(opt, value, basePath, errors, propertyAssignment, val
|
|
|
36635
36764
|
return convertJsonOptionOfListType(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile);
|
|
36636
36765
|
} else if (optType === "listOrElement") {
|
|
36637
36766
|
return isArray(value) ? convertJsonOptionOfListType(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile) : convertJsonOption(opt.element, value, basePath, errors, propertyAssignment, valueExpression, sourceFile);
|
|
36767
|
+
} else if (optType === "objectOrShorthand") {
|
|
36768
|
+
if (!value || typeof value !== "object") {
|
|
36769
|
+
if (!isString(opt.shorthandType)) {
|
|
36770
|
+
return convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sourceFile);
|
|
36771
|
+
}
|
|
36772
|
+
const validatedValue2 = validateJsonOptionValue(opt, value, errors, valueExpression, sourceFile);
|
|
36773
|
+
return isNullOrUndefined(validatedValue2) ? validatedValue2 : normalizeNonListOptionValue(opt, basePath, validatedValue2);
|
|
36774
|
+
} else {
|
|
36775
|
+
return {};
|
|
36776
|
+
}
|
|
36638
36777
|
} else if (!isString(opt.type)) {
|
|
36639
36778
|
return convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sourceFile);
|
|
36640
36779
|
}
|
|
@@ -36667,7 +36806,8 @@ function convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sour
|
|
|
36667
36806
|
if (isNullOrUndefined(value))
|
|
36668
36807
|
return void 0;
|
|
36669
36808
|
const key = value.toLowerCase();
|
|
36670
|
-
const
|
|
36809
|
+
const type = opt.type === "objectOrShorthand" ? opt.shorthandType : opt.type;
|
|
36810
|
+
const val = type.get(key);
|
|
36671
36811
|
if (val !== void 0) {
|
|
36672
36812
|
return validateJsonOptionValue(opt, val, errors, valueExpression, sourceFile);
|
|
36673
36813
|
} else {
|
|
@@ -36894,7 +37034,8 @@ function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, exte
|
|
|
36894
37034
|
}
|
|
36895
37035
|
}
|
|
36896
37036
|
function getDefaultValueForOption(option) {
|
|
36897
|
-
|
|
37037
|
+
const type = option.type === "objectOrShorthand" ? option.shorthandType : option.type;
|
|
37038
|
+
switch (type) {
|
|
36898
37039
|
case "number":
|
|
36899
37040
|
return 1;
|
|
36900
37041
|
case "boolean":
|
|
@@ -44707,7 +44848,7 @@ function createTypeChecker(host) {
|
|
|
44707
44848
|
return isBlockScopedNameDeclaredBeforeUse(getAncestor(declaration, 260 /* VariableDeclaration */), usage);
|
|
44708
44849
|
} else if (declaration.kind === 260 /* VariableDeclaration */) {
|
|
44709
44850
|
return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
|
|
44710
|
-
} else if (
|
|
44851
|
+
} else if (isClassLike(declaration)) {
|
|
44711
44852
|
return !findAncestor(usage, (n) => isComputedPropertyName(n) && n.parent.parent === declaration);
|
|
44712
44853
|
} else if (isPropertyDeclaration(declaration)) {
|
|
44713
44854
|
return !isPropertyImmediatelyReferencedWithinDeclaration(
|
|
@@ -45631,19 +45772,16 @@ function createTypeChecker(host) {
|
|
|
45631
45772
|
return isStringLiteralLike(usage) ? getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
|
|
45632
45773
|
}
|
|
45633
45774
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
45634
|
-
return usageMode === 99 /* ESNext */ && targetMode
|
|
45775
|
+
return usageMode === 99 /* ESNext */ && targetMode !== 99 /* ESNext */;
|
|
45635
45776
|
}
|
|
45636
45777
|
function isOnlyImportedAsDefault(usage) {
|
|
45637
45778
|
const usageMode = getUsageModeForExpression(usage);
|
|
45638
45779
|
return usageMode === 99 /* ESNext */ && endsWith(usage.text, ".json" /* Json */);
|
|
45639
45780
|
}
|
|
45640
45781
|
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
|
|
45641
|
-
const usageMode = file && getUsageModeForExpression(usage);
|
|
45642
|
-
if (
|
|
45643
|
-
|
|
45644
|
-
if (usageMode === 99 /* ESNext */ || result) {
|
|
45645
|
-
return result;
|
|
45646
|
-
}
|
|
45782
|
+
const usageMode = file && getModuleFormatInteropKind(compilerOptions) !== 1 /* Babel */ && getUsageModeForExpression(usage);
|
|
45783
|
+
if (usageMode === 99 /* ESNext */) {
|
|
45784
|
+
return isESMFormatImportImportingCommonjsFormatFile(usageMode, file.impliedNodeFormat);
|
|
45647
45785
|
}
|
|
45648
45786
|
if (!allowSyntheticDefaultImports) {
|
|
45649
45787
|
return false;
|
|
@@ -46536,6 +46674,7 @@ function createTypeChecker(host) {
|
|
|
46536
46674
|
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = findAncestor(location, isImportCall)) == null ? void 0 : _a.arguments[0]) || ((_b = findAncestor(location, isImportDeclaration)) == null ? void 0 : _b.moduleSpecifier) || ((_c = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _c.moduleReference.expression) || ((_d = findAncestor(location, isExportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _e.name) || ((_f = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _f.argument.literal);
|
|
46537
46675
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
46538
46676
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
46677
|
+
const moduleFormatInterop = getModuleFormatInteropKind(compilerOptions);
|
|
46539
46678
|
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
46540
46679
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
46541
46680
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -46571,7 +46710,7 @@ function createTypeChecker(host) {
|
|
|
46571
46710
|
moduleReference
|
|
46572
46711
|
);
|
|
46573
46712
|
}
|
|
46574
|
-
if (
|
|
46713
|
+
if (moduleFormatInterop === 100 /* Node16 */ || moduleFormatInterop === 199 /* NodeNext */) {
|
|
46575
46714
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
46576
46715
|
const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
46577
46716
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !hasResolutionModeOverride(overrideHost)) {
|
|
@@ -53621,10 +53760,11 @@ function createTypeChecker(host) {
|
|
|
53621
53760
|
const baseTypes = getBaseTypes(source);
|
|
53622
53761
|
if (baseTypes.length) {
|
|
53623
53762
|
if (source.symbol && members === getMembersOfSymbol(source.symbol)) {
|
|
53624
|
-
const symbolTable = createSymbolTable(
|
|
53625
|
-
const
|
|
53626
|
-
|
|
53627
|
-
|
|
53763
|
+
const symbolTable = createSymbolTable();
|
|
53764
|
+
for (const symbol of members.values()) {
|
|
53765
|
+
if (!(symbol.flags & 262144 /* TypeParameter */)) {
|
|
53766
|
+
symbolTable.set(symbol.escapedName, symbol);
|
|
53767
|
+
}
|
|
53628
53768
|
}
|
|
53629
53769
|
members = symbolTable;
|
|
53630
53770
|
}
|
|
@@ -55324,6 +55464,7 @@ function createTypeChecker(host) {
|
|
|
55324
55464
|
let flags = 0 /* None */;
|
|
55325
55465
|
let minArgumentCount = 0;
|
|
55326
55466
|
let thisParameter;
|
|
55467
|
+
let thisTag = isInJSFile(declaration) ? getJSDocThisTag(declaration) : void 0;
|
|
55327
55468
|
let hasThisParameter = false;
|
|
55328
55469
|
const iife = getImmediatelyInvokedFunctionExpression(declaration);
|
|
55329
55470
|
const isJSConstructSignature = isJSDocConstructSignature(declaration);
|
|
@@ -55333,6 +55474,10 @@ function createTypeChecker(host) {
|
|
|
55333
55474
|
}
|
|
55334
55475
|
for (let i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) {
|
|
55335
55476
|
const param = declaration.parameters[i];
|
|
55477
|
+
if (isInJSFile(param) && isJSDocThisTag(param)) {
|
|
55478
|
+
thisTag = param;
|
|
55479
|
+
continue;
|
|
55480
|
+
}
|
|
55336
55481
|
let paramSymbol = param.symbol;
|
|
55337
55482
|
const type = isJSDocParameterTag(param) ? param.typeExpression && param.typeExpression.type : param.type;
|
|
55338
55483
|
if (paramSymbol && !!(paramSymbol.flags & 4 /* Property */) && !isBindingPattern(param.name)) {
|
|
@@ -55370,11 +55515,8 @@ function createTypeChecker(host) {
|
|
|
55370
55515
|
thisParameter = getAnnotatedAccessorThisParameter(other);
|
|
55371
55516
|
}
|
|
55372
55517
|
}
|
|
55373
|
-
if (
|
|
55374
|
-
|
|
55375
|
-
if (thisTag && thisTag.typeExpression) {
|
|
55376
|
-
thisParameter = createSymbolWithType(createSymbol(1 /* FunctionScopedVariable */, "this" /* This */), getTypeFromTypeNode(thisTag.typeExpression));
|
|
55377
|
-
}
|
|
55518
|
+
if (thisTag && thisTag.typeExpression) {
|
|
55519
|
+
thisParameter = createSymbolWithType(createSymbol(1 /* FunctionScopedVariable */, "this" /* This */), getTypeFromTypeNode(thisTag.typeExpression));
|
|
55378
55520
|
}
|
|
55379
55521
|
const hostDeclaration = isJSDocSignature(declaration) ? getEffectiveJSDocHost(declaration) : declaration;
|
|
55380
55522
|
const classType = hostDeclaration && isConstructorDeclaration(hostDeclaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(hostDeclaration.parent.symbol)) : void 0;
|
|
@@ -60173,8 +60315,8 @@ function createTypeChecker(host) {
|
|
|
60173
60315
|
const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
|
|
60174
60316
|
const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
|
|
60175
60317
|
if (sourceType && targetType) {
|
|
60176
|
-
const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
60177
|
-
const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
60318
|
+
const sourceSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(source, i) ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
60319
|
+
const targetSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(target, i) ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
60178
60320
|
const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
|
|
60179
60321
|
let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
|
|
60180
60322
|
sourceType,
|
|
@@ -70724,6 +70866,10 @@ function createTypeChecker(host) {
|
|
|
70724
70866
|
const minTypeArgumentCount = getMinTypeArgumentCount(signature.typeParameters);
|
|
70725
70867
|
return !some(typeArguments) || typeArguments.length >= minTypeArgumentCount && typeArguments.length <= numTypeParameters;
|
|
70726
70868
|
}
|
|
70869
|
+
function isInstantiatedGenericParameter(signature, pos) {
|
|
70870
|
+
let type;
|
|
70871
|
+
return !!(signature.target && (type = tryGetTypeAtPosition(signature.target, pos)) && isGenericType(type));
|
|
70872
|
+
}
|
|
70727
70873
|
function getSingleCallSignature(type) {
|
|
70728
70874
|
return getSingleSignature(
|
|
70729
70875
|
type,
|
|
@@ -73139,9 +73285,16 @@ function createTypeChecker(host) {
|
|
|
73139
73285
|
const len = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
|
|
73140
73286
|
for (let i = 0; i < len; i++) {
|
|
73141
73287
|
const parameter = signature.parameters[i];
|
|
73142
|
-
|
|
73143
|
-
|
|
73144
|
-
|
|
73288
|
+
const declaration = parameter.valueDeclaration;
|
|
73289
|
+
if (!getEffectiveTypeAnnotationNode(declaration)) {
|
|
73290
|
+
let type = tryGetTypeAtPosition(context, i);
|
|
73291
|
+
if (type && declaration.initializer) {
|
|
73292
|
+
let initializerType = checkDeclarationInitializer(declaration, 0 /* Normal */);
|
|
73293
|
+
if (!isTypeAssignableTo(initializerType, type) && isTypeAssignableTo(type, initializerType = widenTypeInferredFromInitializer(declaration, initializerType))) {
|
|
73294
|
+
type = initializerType;
|
|
73295
|
+
}
|
|
73296
|
+
}
|
|
73297
|
+
assignParameterType(parameter, type);
|
|
73145
73298
|
}
|
|
73146
73299
|
}
|
|
73147
73300
|
if (signatureHasRestParameter(signature)) {
|
|
@@ -107331,7 +107484,7 @@ function transformECMAScriptModule(context) {
|
|
|
107331
107484
|
return node.isExportEquals ? void 0 : node;
|
|
107332
107485
|
}
|
|
107333
107486
|
function visitExportDeclaration(node) {
|
|
107334
|
-
if (compilerOptions
|
|
107487
|
+
if (getEmitModuleKind(compilerOptions) > 5 /* ES2015 */) {
|
|
107335
107488
|
return node;
|
|
107336
107489
|
}
|
|
107337
107490
|
if (!node.exportClause || !isNamespaceExport(node.exportClause) || !node.moduleSpecifier) {
|
|
@@ -116521,20 +116674,25 @@ function getConfigFileParsingDiagnostics(configFileParseResult) {
|
|
|
116521
116674
|
return configFileParseResult.options.configFile ? [...configFileParseResult.options.configFile.parseDiagnostics, ...configFileParseResult.errors] : configFileParseResult.errors;
|
|
116522
116675
|
}
|
|
116523
116676
|
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
116524
|
-
|
|
116525
|
-
|
|
116526
|
-
case
|
|
116527
|
-
|
|
116677
|
+
const formatDetection = getModuleFormatDetectionKind(options);
|
|
116678
|
+
switch (formatDetection) {
|
|
116679
|
+
case 1 /* Bundler */:
|
|
116680
|
+
case 100 /* Node16 */:
|
|
116681
|
+
case 199 /* NodeNext */:
|
|
116682
|
+
case 2 /* DefaultModule */:
|
|
116683
|
+
case 3 /* DefaultCommonJS */:
|
|
116684
|
+
const defaultFormat = formatDetection === 1 /* Bundler */ ? void 0 : formatDetection === 2 /* DefaultModule */ ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
116685
|
+
return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson(defaultFormat) : void 0;
|
|
116528
116686
|
default:
|
|
116529
116687
|
return void 0;
|
|
116530
116688
|
}
|
|
116531
|
-
function lookupFromPackageJson() {
|
|
116689
|
+
function lookupFromPackageJson(defaultFormat) {
|
|
116532
116690
|
const state = getTemporaryModuleResolutionState(packageJsonInfoCache, host, options);
|
|
116533
116691
|
const packageJsonLocations = [];
|
|
116534
116692
|
state.failedLookupLocations = packageJsonLocations;
|
|
116535
116693
|
state.affectingLocations = packageJsonLocations;
|
|
116536
116694
|
const packageJsonScope = getPackageScopeForPath(fileName, state);
|
|
116537
|
-
const impliedNodeFormat = (packageJsonScope == null ? void 0 : packageJsonScope.contents.packageJsonContent.type) === "module" ? 99 /* ESNext */ : 1 /* CommonJS
|
|
116695
|
+
const impliedNodeFormat = (packageJsonScope == null ? void 0 : packageJsonScope.contents.packageJsonContent.type) === "module" ? 99 /* ESNext */ : (packageJsonScope == null ? void 0 : packageJsonScope.contents.packageJsonContent.type) === "commonjs" ? 1 /* CommonJS */ : defaultFormat;
|
|
116538
116696
|
return { impliedNodeFormat, packageJsonLocations, packageJsonScope };
|
|
116539
116697
|
}
|
|
116540
116698
|
}
|
|
@@ -126313,11 +126471,12 @@ function generateOptionOutput(sys2, option, rightAlignOfLeft, leftAlignOfRight)
|
|
|
126313
126471
|
}
|
|
126314
126472
|
function getPossibleValues(option3) {
|
|
126315
126473
|
let possibleValues;
|
|
126316
|
-
|
|
126474
|
+
const type = option3.type === "objectOrShorthand" ? option3.shorthandType : option3.type;
|
|
126475
|
+
switch (type) {
|
|
126317
126476
|
case "string":
|
|
126318
126477
|
case "number":
|
|
126319
126478
|
case "boolean":
|
|
126320
|
-
possibleValues =
|
|
126479
|
+
possibleValues = type;
|
|
126321
126480
|
break;
|
|
126322
126481
|
case "list":
|
|
126323
126482
|
case "listOrElement":
|
|
@@ -126328,7 +126487,7 @@ function generateOptionOutput(sys2, option, rightAlignOfLeft, leftAlignOfRight)
|
|
|
126328
126487
|
break;
|
|
126329
126488
|
default:
|
|
126330
126489
|
const inverted = {};
|
|
126331
|
-
|
|
126490
|
+
type.forEach((value, name2) => {
|
|
126332
126491
|
var _a2;
|
|
126333
126492
|
if (!((_a2 = option3.deprecatedKeys) == null ? void 0 : _a2.has(name2))) {
|
|
126334
126493
|
(inverted[value] || (inverted[value] = [])).push(name2);
|