typescript 5.4.0-dev.20231208 → 5.4.0-dev.20231209

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 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-dev.20231208`;
21
+ var version = `${versionMajorMinor}.0-dev.20231209`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -16362,38 +16362,231 @@ function getSetExternalModuleIndicator(options) {
16362
16362
  return callback;
16363
16363
  }
16364
16364
  }
16365
- function getEmitScriptTarget(compilerOptions) {
16366
- return compilerOptions.target ?? (compilerOptions.module === 100 /* Node16 */ && 9 /* ES2022 */ || compilerOptions.module === 199 /* NodeNext */ && 99 /* ESNext */ || 1 /* ES5 */);
16367
- }
16368
- function getEmitModuleKind(compilerOptions) {
16369
- return typeof compilerOptions.module === "number" ? compilerOptions.module : getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */ ? 5 /* ES2015 */ : 1 /* CommonJS */;
16365
+ function createComputedCompilerOptions(options) {
16366
+ return options;
16370
16367
  }
16368
+ var computedOptions = createComputedCompilerOptions({
16369
+ target: {
16370
+ dependencies: ["module"],
16371
+ computeValue: (compilerOptions) => {
16372
+ return compilerOptions.target ?? (compilerOptions.module === 100 /* Node16 */ && 9 /* ES2022 */ || compilerOptions.module === 199 /* NodeNext */ && 99 /* ESNext */ || 1 /* ES5 */);
16373
+ }
16374
+ },
16375
+ module: {
16376
+ dependencies: ["target"],
16377
+ computeValue: (compilerOptions) => {
16378
+ return typeof compilerOptions.module === "number" ? compilerOptions.module : computedOptions.target.computeValue(compilerOptions) >= 2 /* ES2015 */ ? 5 /* ES2015 */ : 1 /* CommonJS */;
16379
+ }
16380
+ },
16381
+ moduleResolution: {
16382
+ dependencies: ["module", "target"],
16383
+ computeValue: (compilerOptions) => {
16384
+ let moduleResolution = compilerOptions.moduleResolution;
16385
+ if (moduleResolution === void 0) {
16386
+ switch (computedOptions.module.computeValue(compilerOptions)) {
16387
+ case 1 /* CommonJS */:
16388
+ moduleResolution = 2 /* Node10 */;
16389
+ break;
16390
+ case 100 /* Node16 */:
16391
+ moduleResolution = 3 /* Node16 */;
16392
+ break;
16393
+ case 199 /* NodeNext */:
16394
+ moduleResolution = 99 /* NodeNext */;
16395
+ break;
16396
+ default:
16397
+ moduleResolution = 1 /* Classic */;
16398
+ break;
16399
+ }
16400
+ }
16401
+ return moduleResolution;
16402
+ }
16403
+ },
16404
+ moduleDetection: {
16405
+ dependencies: ["module", "target"],
16406
+ computeValue: (compilerOptions) => {
16407
+ return compilerOptions.moduleDetection || (computedOptions.module.computeValue(compilerOptions) === 100 /* Node16 */ || computedOptions.module.computeValue(compilerOptions) === 199 /* NodeNext */ ? 3 /* Force */ : 2 /* Auto */);
16408
+ }
16409
+ },
16410
+ isolatedModules: {
16411
+ dependencies: ["verbatimModuleSyntax"],
16412
+ computeValue: (compilerOptions) => {
16413
+ return !!(compilerOptions.isolatedModules || compilerOptions.verbatimModuleSyntax);
16414
+ }
16415
+ },
16416
+ esModuleInterop: {
16417
+ dependencies: ["module", "target"],
16418
+ computeValue: (compilerOptions) => {
16419
+ if (compilerOptions.esModuleInterop !== void 0) {
16420
+ return compilerOptions.esModuleInterop;
16421
+ }
16422
+ switch (computedOptions.module.computeValue(compilerOptions)) {
16423
+ case 100 /* Node16 */:
16424
+ case 199 /* NodeNext */:
16425
+ return true;
16426
+ }
16427
+ return false;
16428
+ }
16429
+ },
16430
+ allowSyntheticDefaultImports: {
16431
+ dependencies: ["module", "target", "moduleResolution"],
16432
+ computeValue: (compilerOptions) => {
16433
+ if (compilerOptions.allowSyntheticDefaultImports !== void 0) {
16434
+ return compilerOptions.allowSyntheticDefaultImports;
16435
+ }
16436
+ return computedOptions.esModuleInterop.computeValue(compilerOptions) || computedOptions.module.computeValue(compilerOptions) === 4 /* System */ || computedOptions.moduleResolution.computeValue(compilerOptions) === 100 /* Bundler */;
16437
+ }
16438
+ },
16439
+ resolvePackageJsonExports: {
16440
+ dependencies: ["moduleResolution"],
16441
+ computeValue: (compilerOptions) => {
16442
+ const moduleResolution = computedOptions.moduleResolution.computeValue(compilerOptions);
16443
+ if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
16444
+ return false;
16445
+ }
16446
+ if (compilerOptions.resolvePackageJsonExports !== void 0) {
16447
+ return compilerOptions.resolvePackageJsonExports;
16448
+ }
16449
+ switch (moduleResolution) {
16450
+ case 3 /* Node16 */:
16451
+ case 99 /* NodeNext */:
16452
+ case 100 /* Bundler */:
16453
+ return true;
16454
+ }
16455
+ return false;
16456
+ }
16457
+ },
16458
+ resolvePackageJsonImports: {
16459
+ dependencies: ["moduleResolution", "resolvePackageJsonExports"],
16460
+ computeValue: (compilerOptions) => {
16461
+ const moduleResolution = computedOptions.moduleResolution.computeValue(compilerOptions);
16462
+ if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
16463
+ return false;
16464
+ }
16465
+ if (compilerOptions.resolvePackageJsonExports !== void 0) {
16466
+ return compilerOptions.resolvePackageJsonExports;
16467
+ }
16468
+ switch (moduleResolution) {
16469
+ case 3 /* Node16 */:
16470
+ case 99 /* NodeNext */:
16471
+ case 100 /* Bundler */:
16472
+ return true;
16473
+ }
16474
+ return false;
16475
+ }
16476
+ },
16477
+ resolveJsonModule: {
16478
+ dependencies: ["moduleResolution", "module", "target"],
16479
+ computeValue: (compilerOptions) => {
16480
+ if (compilerOptions.resolveJsonModule !== void 0) {
16481
+ return compilerOptions.resolveJsonModule;
16482
+ }
16483
+ return computedOptions.moduleResolution.computeValue(compilerOptions) === 100 /* Bundler */;
16484
+ }
16485
+ },
16486
+ declaration: {
16487
+ dependencies: ["composite"],
16488
+ computeValue: (compilerOptions) => {
16489
+ return !!(compilerOptions.declaration || compilerOptions.composite);
16490
+ }
16491
+ },
16492
+ preserveConstEnums: {
16493
+ dependencies: ["isolatedModules", "verbatimModuleSyntax"],
16494
+ computeValue: (compilerOptions) => {
16495
+ return !!(compilerOptions.preserveConstEnums || computedOptions.isolatedModules.computeValue(compilerOptions));
16496
+ }
16497
+ },
16498
+ incremental: {
16499
+ dependencies: ["composite"],
16500
+ computeValue: (compilerOptions) => {
16501
+ return !!(compilerOptions.incremental || compilerOptions.composite);
16502
+ }
16503
+ },
16504
+ declarationMap: {
16505
+ dependencies: ["declaration", "composite"],
16506
+ computeValue: (compilerOptions) => {
16507
+ return !!(compilerOptions.declarationMap && computedOptions.declaration.computeValue(compilerOptions));
16508
+ }
16509
+ },
16510
+ allowJs: {
16511
+ dependencies: ["checkJs"],
16512
+ computeValue: (compilerOptions) => {
16513
+ return compilerOptions.allowJs === void 0 ? !!compilerOptions.checkJs : compilerOptions.allowJs;
16514
+ }
16515
+ },
16516
+ useDefineForClassFields: {
16517
+ dependencies: ["target", "module"],
16518
+ computeValue: (compilerOptions) => {
16519
+ return compilerOptions.useDefineForClassFields === void 0 ? computedOptions.target.computeValue(compilerOptions) >= 9 /* ES2022 */ : compilerOptions.useDefineForClassFields;
16520
+ }
16521
+ },
16522
+ noImplicitAny: {
16523
+ dependencies: ["strict"],
16524
+ computeValue: (compilerOptions) => {
16525
+ return getStrictOptionValue(compilerOptions, "noImplicitAny");
16526
+ }
16527
+ },
16528
+ noImplicitThis: {
16529
+ dependencies: ["strict"],
16530
+ computeValue: (compilerOptions) => {
16531
+ return getStrictOptionValue(compilerOptions, "noImplicitThis");
16532
+ }
16533
+ },
16534
+ strictNullChecks: {
16535
+ dependencies: ["strict"],
16536
+ computeValue: (compilerOptions) => {
16537
+ return getStrictOptionValue(compilerOptions, "strictNullChecks");
16538
+ }
16539
+ },
16540
+ strictFunctionTypes: {
16541
+ dependencies: ["strict"],
16542
+ computeValue: (compilerOptions) => {
16543
+ return getStrictOptionValue(compilerOptions, "strictFunctionTypes");
16544
+ }
16545
+ },
16546
+ strictBindCallApply: {
16547
+ dependencies: ["strict"],
16548
+ computeValue: (compilerOptions) => {
16549
+ return getStrictOptionValue(compilerOptions, "strictBindCallApply");
16550
+ }
16551
+ },
16552
+ strictPropertyInitialization: {
16553
+ dependencies: ["strict"],
16554
+ computeValue: (compilerOptions) => {
16555
+ return getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
16556
+ }
16557
+ },
16558
+ alwaysStrict: {
16559
+ dependencies: ["strict"],
16560
+ computeValue: (compilerOptions) => {
16561
+ return getStrictOptionValue(compilerOptions, "alwaysStrict");
16562
+ }
16563
+ },
16564
+ useUnknownInCatchVariables: {
16565
+ dependencies: ["strict"],
16566
+ computeValue: (compilerOptions) => {
16567
+ return getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
16568
+ }
16569
+ }
16570
+ });
16571
+ var getEmitScriptTarget = computedOptions.target.computeValue;
16572
+ var getEmitModuleKind = computedOptions.module.computeValue;
16573
+ var getEmitModuleResolutionKind = computedOptions.moduleResolution.computeValue;
16574
+ var getEmitModuleDetectionKind = computedOptions.moduleDetection.computeValue;
16575
+ var getIsolatedModules = computedOptions.isolatedModules.computeValue;
16576
+ var getESModuleInterop = computedOptions.esModuleInterop.computeValue;
16577
+ var getAllowSyntheticDefaultImports = computedOptions.allowSyntheticDefaultImports.computeValue;
16578
+ var getResolvePackageJsonExports = computedOptions.resolvePackageJsonExports.computeValue;
16579
+ var getResolvePackageJsonImports = computedOptions.resolvePackageJsonImports.computeValue;
16580
+ var getResolveJsonModule = computedOptions.resolveJsonModule.computeValue;
16581
+ var getEmitDeclarations = computedOptions.declaration.computeValue;
16582
+ var shouldPreserveConstEnums = computedOptions.preserveConstEnums.computeValue;
16583
+ var isIncrementalCompilation = computedOptions.incremental.computeValue;
16584
+ var getAreDeclarationMapsEnabled = computedOptions.declarationMap.computeValue;
16585
+ var getAllowJSCompilerOption = computedOptions.allowJs.computeValue;
16586
+ var getUseDefineForClassFields = computedOptions.useDefineForClassFields.computeValue;
16371
16587
  function emitModuleKindIsNonNodeESM(moduleKind) {
16372
16588
  return moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */;
16373
16589
  }
16374
- function getEmitModuleResolutionKind(compilerOptions) {
16375
- let moduleResolution = compilerOptions.moduleResolution;
16376
- if (moduleResolution === void 0) {
16377
- switch (getEmitModuleKind(compilerOptions)) {
16378
- case 1 /* CommonJS */:
16379
- moduleResolution = 2 /* Node10 */;
16380
- break;
16381
- case 100 /* Node16 */:
16382
- moduleResolution = 3 /* Node16 */;
16383
- break;
16384
- case 199 /* NodeNext */:
16385
- moduleResolution = 99 /* NodeNext */;
16386
- break;
16387
- default:
16388
- moduleResolution = 1 /* Classic */;
16389
- break;
16390
- }
16391
- }
16392
- return moduleResolution;
16393
- }
16394
- function getEmitModuleDetectionKind(options) {
16395
- return options.moduleDetection || (getEmitModuleKind(options) === 100 /* Node16 */ || getEmitModuleKind(options) === 199 /* NodeNext */ ? 3 /* Force */ : 2 /* Auto */);
16396
- }
16397
16590
  function hasJsonModuleEmitEnabled(options) {
16398
16591
  switch (getEmitModuleKind(options)) {
16399
16592
  case 1 /* CommonJS */:
@@ -16409,81 +16602,21 @@ function hasJsonModuleEmitEnabled(options) {
16409
16602
  return false;
16410
16603
  }
16411
16604
  }
16412
- function getIsolatedModules(options) {
16413
- return !!(options.isolatedModules || options.verbatimModuleSyntax);
16414
- }
16415
16605
  function unreachableCodeIsError(options) {
16416
16606
  return options.allowUnreachableCode === false;
16417
16607
  }
16418
16608
  function unusedLabelIsError(options) {
16419
16609
  return options.allowUnusedLabels === false;
16420
16610
  }
16421
- function getAreDeclarationMapsEnabled(options) {
16422
- return !!(getEmitDeclarations(options) && options.declarationMap);
16423
- }
16424
- function getESModuleInterop(compilerOptions) {
16425
- if (compilerOptions.esModuleInterop !== void 0) {
16426
- return compilerOptions.esModuleInterop;
16427
- }
16428
- switch (getEmitModuleKind(compilerOptions)) {
16429
- case 100 /* Node16 */:
16430
- case 199 /* NodeNext */:
16431
- return true;
16432
- }
16433
- return void 0;
16434
- }
16435
- function getAllowSyntheticDefaultImports(compilerOptions) {
16436
- if (compilerOptions.allowSyntheticDefaultImports !== void 0) {
16437
- return compilerOptions.allowSyntheticDefaultImports;
16438
- }
16439
- return getESModuleInterop(compilerOptions) || getEmitModuleKind(compilerOptions) === 4 /* System */ || getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */;
16440
- }
16441
16611
  function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
16442
16612
  return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
16443
16613
  }
16444
16614
  function shouldResolveJsRequire(compilerOptions) {
16445
16615
  return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */;
16446
16616
  }
16447
- function getResolvePackageJsonExports(compilerOptions) {
16448
- const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
16449
- if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
16450
- return false;
16451
- }
16452
- if (compilerOptions.resolvePackageJsonExports !== void 0) {
16453
- return compilerOptions.resolvePackageJsonExports;
16454
- }
16455
- switch (moduleResolution) {
16456
- case 3 /* Node16 */:
16457
- case 99 /* NodeNext */:
16458
- case 100 /* Bundler */:
16459
- return true;
16460
- }
16461
- return false;
16462
- }
16463
- function getResolveJsonModule(compilerOptions) {
16464
- if (compilerOptions.resolveJsonModule !== void 0) {
16465
- return compilerOptions.resolveJsonModule;
16466
- }
16467
- return getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */;
16468
- }
16469
- function getEmitDeclarations(compilerOptions) {
16470
- return !!(compilerOptions.declaration || compilerOptions.composite);
16471
- }
16472
- function shouldPreserveConstEnums(compilerOptions) {
16473
- return !!(compilerOptions.preserveConstEnums || getIsolatedModules(compilerOptions));
16474
- }
16475
- function isIncrementalCompilation(options) {
16476
- return !!(options.incremental || options.composite);
16477
- }
16478
16617
  function getStrictOptionValue(compilerOptions, flag) {
16479
16618
  return compilerOptions[flag] === void 0 ? !!compilerOptions.strict : !!compilerOptions[flag];
16480
16619
  }
16481
- function getAllowJSCompilerOption(compilerOptions) {
16482
- return compilerOptions.allowJs === void 0 ? !!compilerOptions.checkJs : compilerOptions.allowJs;
16483
- }
16484
- function getUseDefineForClassFields(compilerOptions) {
16485
- return compilerOptions.useDefineForClassFields === void 0 ? getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */ : compilerOptions.useDefineForClassFields;
16486
- }
16487
16620
  function getEmitStandardClassFields(compilerOptions) {
16488
16621
  return compilerOptions.useDefineForClassFields !== false && getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */;
16489
16622
  }
@@ -35895,7 +36028,8 @@ function convertToTSConfig(configParseResult, configFileName, host) {
35895
36028
  ),
35896
36029
  (f) => getRelativePathFromFile(getNormalizedAbsolutePath(configFileName, host.getCurrentDirectory()), getNormalizedAbsolutePath(f, host.getCurrentDirectory()), getCanonicalFileName)
35897
36030
  );
35898
- const optionMap = serializeCompilerOptions(configParseResult.options, { configFilePath: getNormalizedAbsolutePath(configFileName, host.getCurrentDirectory()), useCaseSensitiveFileNames: host.useCaseSensitiveFileNames });
36031
+ const pathOptions = { configFilePath: getNormalizedAbsolutePath(configFileName, host.getCurrentDirectory()), useCaseSensitiveFileNames: host.useCaseSensitiveFileNames };
36032
+ const optionMap = serializeCompilerOptions(configParseResult.options, pathOptions);
35899
36033
  const watchOptionMap = configParseResult.watchOptions && serializeWatchOptions(configParseResult.watchOptions);
35900
36034
  const config = {
35901
36035
  compilerOptions: {
@@ -35920,6 +36054,18 @@ function convertToTSConfig(configParseResult, configFileName, host) {
35920
36054
  } : {},
35921
36055
  compileOnSave: !!configParseResult.compileOnSave ? true : void 0
35922
36056
  };
36057
+ const providedKeys = new Set(optionMap.keys());
36058
+ const impliedCompilerOptions = {};
36059
+ for (const option in computedOptions) {
36060
+ if (!providedKeys.has(option) && some(computedOptions[option].dependencies, (dep) => providedKeys.has(dep))) {
36061
+ const implied = computedOptions[option].computeValue(configParseResult.options);
36062
+ const defaultValue = computedOptions[option].computeValue({});
36063
+ if (implied !== defaultValue) {
36064
+ impliedCompilerOptions[option] = computedOptions[option].computeValue(configParseResult.options);
36065
+ }
36066
+ }
36067
+ }
36068
+ assign(config.compilerOptions, optionMapToObject(serializeCompilerOptions(impliedCompilerOptions, pathOptions)));
35923
36069
  return config;
35924
36070
  }
35925
36071
  function optionMapToObject(optionMap) {
@@ -58303,7 +58449,9 @@ function createTypeChecker(host) {
58303
58449
  if (checkType === wildcardType || extendsType === wildcardType) {
58304
58450
  return wildcardType;
58305
58451
  }
58306
- const checkTuples = isSimpleTupleType(root.node.checkType) && isSimpleTupleType(root.node.extendsType) && length(root.node.checkType.elements) === length(root.node.extendsType.elements);
58452
+ const checkTypeNode = skipTypeParentheses(root.node.checkType);
58453
+ const extendsTypeNode = skipTypeParentheses(root.node.extendsType);
58454
+ const checkTuples = isSimpleTupleType(checkTypeNode) && isSimpleTupleType(extendsTypeNode) && length(checkTypeNode.elements) === length(extendsTypeNode.elements);
58307
58455
  const checkTypeDeferred = isDeferredType(checkType, checkTuples);
58308
58456
  let combinedMapper;
58309
58457
  if (root.inferTypeParameters) {