@typescript-deploys/pr-build 5.5.0-pr-58264-13 → 5.5.0-pr-58299-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 CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.5";
21
- var version = `${versionMajorMinor}.0-insiders.20240422`;
21
+ var version = `${versionMajorMinor}.0-insiders.20240424`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -76993,7 +76993,7 @@ function createTypeChecker(host) {
76993
76993
  parent = parent.parent;
76994
76994
  }
76995
76995
  if (operator === 56 /* AmpersandAmpersandToken */ || isIfStatement(parent)) {
76996
- checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.left, leftType, isIfStatement(parent) ? parent.thenStatement : void 0);
76996
+ checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, isIfStatement(parent) ? parent.thenStatement : void 0);
76997
76997
  }
76998
76998
  checkTruthinessOfType(leftType, node.left);
76999
76999
  }
@@ -77551,7 +77551,7 @@ function createTypeChecker(host) {
77551
77551
  }
77552
77552
  function checkConditionalExpression(node, checkMode) {
77553
77553
  const type = checkTruthinessExpression(node.condition, checkMode);
77554
- checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.condition, type, node.whenTrue);
77554
+ checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue);
77555
77555
  const type1 = checkExpression(node.whenTrue, checkMode);
77556
77556
  const type2 = checkExpression(node.whenFalse, checkMode);
77557
77557
  return getUnionType([type1, type2], 2 /* Subtype */);
@@ -80599,14 +80599,14 @@ function createTypeChecker(host) {
80599
80599
  function checkIfStatement(node) {
80600
80600
  checkGrammarStatementInAmbientContext(node);
80601
80601
  const type = checkTruthinessExpression(node.expression);
80602
- checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.expression, type, node.thenStatement);
80602
+ checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement);
80603
80603
  checkSourceElement(node.thenStatement);
80604
80604
  if (node.thenStatement.kind === 242 /* EmptyStatement */) {
80605
80605
  error(node.thenStatement, Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
80606
80606
  }
80607
80607
  checkSourceElement(node.elseStatement);
80608
80608
  }
80609
- function checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(condExpr, condType, body) {
80609
+ function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) {
80610
80610
  if (!strictNullChecks)
80611
80611
  return;
80612
80612
  bothHelper(condExpr, body);
@@ -80628,10 +80628,6 @@ function createTypeChecker(host) {
80628
80628
  return;
80629
80629
  }
80630
80630
  const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
80631
- if (type.flags & 1024 /* EnumLiteral */ && isPropertyAccessExpression(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & 384 /* Enum */) {
80632
- error(location, Diagnostics.This_condition_will_always_return_0, !!type.value ? "true" : "false");
80633
- return;
80634
- }
80635
80631
  const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
80636
80632
  if (!hasTypeFacts(type, 4194304 /* Truthy */) || isPropertyExpressionCast)
80637
80633
  return;
@@ -118800,6 +118796,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118800
118796
  let resolvedModulesProcessing;
118801
118797
  let resolvedTypeReferenceDirectiveNames;
118802
118798
  let resolvedTypeReferenceDirectiveNamesProcessing;
118799
+ let hasFileNamesDifferOnlyInCasingError = false;
118803
118800
  let packageMap;
118804
118801
  const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
118805
118802
  let currentNodeModulesDepth = 0;
@@ -119144,7 +119141,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119144
119141
  getCanonicalFileName,
119145
119142
  getFileIncludeReasons: () => fileReasons,
119146
119143
  structureIsReused,
119147
- writeFile: writeFile2
119144
+ writeFile: writeFile2,
119145
+ hasFileNamesDifferOnlyInCasingError: () => hasFileNamesDifferOnlyInCasingError
119148
119146
  };
119149
119147
  onProgramCreateComplete();
119150
119148
  fileProcessingDiagnostics == null ? void 0 : fileProcessingDiagnostics.forEach((diagnostic) => {
@@ -119494,6 +119492,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119494
119492
  if (!oldProgram) {
119495
119493
  return 0 /* Not */;
119496
119494
  }
119495
+ if (oldProgram.hasFileNamesDifferOnlyInCasingError()) {
119496
+ return 0 /* Not */;
119497
+ }
119497
119498
  const oldOptions = oldProgram.getCompilerOptions();
119498
119499
  if (changesAffectModuleResolution(oldOptions, options)) {
119499
119500
  return 0 /* Not */;
@@ -120463,6 +120464,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120463
120464
  );
120464
120465
  }
120465
120466
  function reportFileNamesDifferOnlyInCasingError(fileName, existingFile, reason) {
120467
+ hasFileNamesDifferOnlyInCasingError = true;
120466
120468
  const hasExistingReasonToReportErrorOn = !isReferencedFile(reason) && some(fileReasons.get(existingFile.path), isReferencedFile);
120467
120469
  if (hasExistingReasonToReportErrorOn) {
120468
120470
  addFilePreprocessingFileExplainingDiagnostic(existingFile, reason, Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, [existingFile.fileName, fileName]);
@@ -11190,6 +11190,7 @@ declare namespace ts {
11190
11190
  };
11191
11191
  function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo;
11192
11192
  function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput;
11193
+ function transpileDeclaration(input: string, transpileOptions: TranspileOptions): TranspileOutput;
11193
11194
  function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string;
11194
11195
  interface TranspileOptions {
11195
11196
  compilerOptions?: CompilerOptions;
package/lib/typescript.js CHANGED
@@ -2272,6 +2272,7 @@ __export(typescript_exports, {
2272
2272
  transformSystemModule: () => transformSystemModule,
2273
2273
  transformTypeScript: () => transformTypeScript,
2274
2274
  transpile: () => transpile,
2275
+ transpileDeclaration: () => transpileDeclaration,
2275
2276
  transpileModule: () => transpileModule,
2276
2277
  transpileOptionValueCompilerOptions: () => transpileOptionValueCompilerOptions,
2277
2278
  tryAddToSet: () => tryAddToSet,
@@ -2360,7 +2361,7 @@ module.exports = __toCommonJS(typescript_exports);
2360
2361
 
2361
2362
  // src/compiler/corePublic.ts
2362
2363
  var versionMajorMinor = "5.5";
2363
- var version = `${versionMajorMinor}.0-insiders.20240422`;
2364
+ var version = `${versionMajorMinor}.0-insiders.20240424`;
2364
2365
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2365
2366
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2366
2367
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -81817,7 +81818,7 @@ function createTypeChecker(host) {
81817
81818
  parent2 = parent2.parent;
81818
81819
  }
81819
81820
  if (operator === 56 /* AmpersandAmpersandToken */ || isIfStatement(parent2)) {
81820
- checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.left, leftType, isIfStatement(parent2) ? parent2.thenStatement : void 0);
81821
+ checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, isIfStatement(parent2) ? parent2.thenStatement : void 0);
81821
81822
  }
81822
81823
  checkTruthinessOfType(leftType, node.left);
81823
81824
  }
@@ -82375,7 +82376,7 @@ function createTypeChecker(host) {
82375
82376
  }
82376
82377
  function checkConditionalExpression(node, checkMode) {
82377
82378
  const type = checkTruthinessExpression(node.condition, checkMode);
82378
- checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.condition, type, node.whenTrue);
82379
+ checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue);
82379
82380
  const type1 = checkExpression(node.whenTrue, checkMode);
82380
82381
  const type2 = checkExpression(node.whenFalse, checkMode);
82381
82382
  return getUnionType([type1, type2], 2 /* Subtype */);
@@ -85423,14 +85424,14 @@ function createTypeChecker(host) {
85423
85424
  function checkIfStatement(node) {
85424
85425
  checkGrammarStatementInAmbientContext(node);
85425
85426
  const type = checkTruthinessExpression(node.expression);
85426
- checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.expression, type, node.thenStatement);
85427
+ checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement);
85427
85428
  checkSourceElement(node.thenStatement);
85428
85429
  if (node.thenStatement.kind === 242 /* EmptyStatement */) {
85429
85430
  error2(node.thenStatement, Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
85430
85431
  }
85431
85432
  checkSourceElement(node.elseStatement);
85432
85433
  }
85433
- function checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(condExpr, condType, body) {
85434
+ function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) {
85434
85435
  if (!strictNullChecks)
85435
85436
  return;
85436
85437
  bothHelper(condExpr, body);
@@ -85452,10 +85453,6 @@ function createTypeChecker(host) {
85452
85453
  return;
85453
85454
  }
85454
85455
  const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
85455
- if (type.flags & 1024 /* EnumLiteral */ && isPropertyAccessExpression(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & 384 /* Enum */) {
85456
- error2(location, Diagnostics.This_condition_will_always_return_0, !!type.value ? "true" : "false");
85457
- return;
85458
- }
85459
85456
  const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
85460
85457
  if (!hasTypeFacts(type, 4194304 /* Truthy */) || isPropertyExpressionCast)
85461
85458
  return;
@@ -123868,6 +123865,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123868
123865
  let resolvedModulesProcessing;
123869
123866
  let resolvedTypeReferenceDirectiveNames;
123870
123867
  let resolvedTypeReferenceDirectiveNamesProcessing;
123868
+ let hasFileNamesDifferOnlyInCasingError = false;
123871
123869
  let packageMap;
123872
123870
  const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
123873
123871
  let currentNodeModulesDepth = 0;
@@ -124212,7 +124210,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124212
124210
  getCanonicalFileName,
124213
124211
  getFileIncludeReasons: () => fileReasons,
124214
124212
  structureIsReused,
124215
- writeFile: writeFile2
124213
+ writeFile: writeFile2,
124214
+ hasFileNamesDifferOnlyInCasingError: () => hasFileNamesDifferOnlyInCasingError
124216
124215
  };
124217
124216
  onProgramCreateComplete();
124218
124217
  fileProcessingDiagnostics == null ? void 0 : fileProcessingDiagnostics.forEach((diagnostic) => {
@@ -124562,6 +124561,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124562
124561
  if (!oldProgram) {
124563
124562
  return 0 /* Not */;
124564
124563
  }
124564
+ if (oldProgram.hasFileNamesDifferOnlyInCasingError()) {
124565
+ return 0 /* Not */;
124566
+ }
124565
124567
  const oldOptions = oldProgram.getCompilerOptions();
124566
124568
  if (changesAffectModuleResolution(oldOptions, options)) {
124567
124569
  return 0 /* Not */;
@@ -125531,6 +125533,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125531
125533
  );
125532
125534
  }
125533
125535
  function reportFileNamesDifferOnlyInCasingError(fileName, existingFile, reason) {
125536
+ hasFileNamesDifferOnlyInCasingError = true;
125534
125537
  const hasExistingReasonToReportErrorOn = !isReferencedFile(reason) && some(fileReasons.get(existingFile.path), isReferencedFile);
125535
125538
  if (hasExistingReasonToReportErrorOn) {
125536
125539
  addFilePreprocessingFileExplainingDiagnostic(existingFile, reason, Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, [existingFile.fileName, fileName]);
@@ -141568,6 +141571,44 @@ var optionsRedundantWithVerbatimModuleSyntax = /* @__PURE__ */ new Set([
141568
141571
  "isolatedModules"
141569
141572
  ]);
141570
141573
  function transpileModule(input, transpileOptions) {
141574
+ return transpileWorker(
141575
+ input,
141576
+ transpileOptions,
141577
+ /*declaration*/
141578
+ false
141579
+ );
141580
+ }
141581
+ function transpileDeclaration(input, transpileOptions) {
141582
+ return transpileWorker(
141583
+ input,
141584
+ transpileOptions,
141585
+ /*declaration*/
141586
+ true
141587
+ );
141588
+ }
141589
+ var barebonesLibContent = `/// <reference no-default-lib="true"/>
141590
+ interface Boolean {}
141591
+ interface Function {}
141592
+ interface CallableFunction {}
141593
+ interface NewableFunction {}
141594
+ interface IArguments {}
141595
+ interface Number {}
141596
+ interface Object {}
141597
+ interface RegExp {}
141598
+ interface String {}
141599
+ interface Array<T> { length: number; [n: number]: T; }
141600
+ interface SymbolConstructor {
141601
+ (desc?: string | number): symbol;
141602
+ for(name: string): symbol;
141603
+ readonly toStringTag: symbol;
141604
+ }
141605
+ declare var Symbol: SymbolConstructor;
141606
+ interface Symbol {
141607
+ readonly [Symbol.toStringTag]: string;
141608
+ }`;
141609
+ var barebonesLibName = "lib.d.ts";
141610
+ var barebonesLibSourceFile = createSourceFile(barebonesLibName, barebonesLibContent, { languageVersion: 99 /* Latest */ });
141611
+ function transpileWorker(input, transpileOptions, declaration) {
141571
141612
  const diagnostics = [];
141572
141613
  const options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : {};
141573
141614
  const defaultOptions = getDefaultCompilerOptions2();
@@ -141584,9 +141625,16 @@ function transpileModule(input, transpileOptions) {
141584
141625
  }
141585
141626
  options.suppressOutputPathCheck = true;
141586
141627
  options.allowNonTsExtensions = true;
141628
+ if (declaration) {
141629
+ options.declaration = true;
141630
+ options.emitDeclarationOnly = true;
141631
+ options.isolatedDeclarations = true;
141632
+ } else {
141633
+ options.declaration = false;
141634
+ }
141587
141635
  const newLine = getNewLineCharacter(options);
141588
141636
  const compilerHost = {
141589
- getSourceFile: (fileName) => fileName === normalizePath(inputFileName) ? sourceFile : void 0,
141637
+ getSourceFile: (fileName) => fileName === normalizePath(inputFileName) ? sourceFile : fileName === normalizePath(barebonesLibName) ? barebonesLibSourceFile : void 0,
141590
141638
  writeFile: (name, text) => {
141591
141639
  if (fileExtensionIs(name, ".map")) {
141592
141640
  Debug.assertEqual(sourceMapText, void 0, "Unexpected multiple source map outputs, file:", name);
@@ -141596,12 +141644,12 @@ function transpileModule(input, transpileOptions) {
141596
141644
  outputText = text;
141597
141645
  }
141598
141646
  },
141599
- getDefaultLibFileName: () => "lib.d.ts",
141647
+ getDefaultLibFileName: () => barebonesLibName,
141600
141648
  useCaseSensitiveFileNames: () => false,
141601
141649
  getCanonicalFileName: (fileName) => fileName,
141602
141650
  getCurrentDirectory: () => "",
141603
141651
  getNewLine: () => newLine,
141604
- fileExists: (fileName) => fileName === inputFileName,
141652
+ fileExists: (fileName) => fileName === inputFileName || !!declaration && fileName === barebonesLibName,
141605
141653
  readFile: () => "",
141606
141654
  directoryExists: () => true,
141607
141655
  getDirectories: () => []
@@ -141631,7 +141679,8 @@ function transpileModule(input, transpileOptions) {
141631
141679
  }
141632
141680
  let outputText;
141633
141681
  let sourceMapText;
141634
- const program = createProgram([inputFileName], options, compilerHost);
141682
+ const inputs = declaration ? [inputFileName, barebonesLibName] : [inputFileName];
141683
+ const program = createProgram(inputs, options, compilerHost);
141635
141684
  if (transpileOptions.reportDiagnostics) {
141636
141685
  addRange(
141637
141686
  /*to*/
@@ -141646,7 +141695,7 @@ function transpileModule(input, transpileOptions) {
141646
141695
  program.getOptionsDiagnostics()
141647
141696
  );
141648
141697
  }
141649
- program.emit(
141698
+ const result = program.emit(
141650
141699
  /*targetSourceFile*/
141651
141700
  void 0,
141652
141701
  /*writeFile*/
@@ -141654,8 +141703,16 @@ function transpileModule(input, transpileOptions) {
141654
141703
  /*cancellationToken*/
141655
141704
  void 0,
141656
141705
  /*emitOnlyDtsFiles*/
141657
- void 0,
141658
- transpileOptions.transformers
141706
+ declaration,
141707
+ transpileOptions.transformers,
141708
+ /*forceDtsEmit*/
141709
+ declaration
141710
+ );
141711
+ addRange(
141712
+ /*to*/
141713
+ diagnostics,
141714
+ /*from*/
141715
+ result.diagnostics
141659
141716
  );
141660
141717
  if (outputText === void 0)
141661
141718
  return Debug.fail("Output generation failed");
@@ -180024,6 +180081,7 @@ __export(ts_exports2, {
180024
180081
  transformSystemModule: () => transformSystemModule,
180025
180082
  transformTypeScript: () => transformTypeScript,
180026
180083
  transpile: () => transpile,
180084
+ transpileDeclaration: () => transpileDeclaration,
180027
180085
  transpileModule: () => transpileModule,
180028
180086
  transpileOptionValueCompilerOptions: () => transpileOptionValueCompilerOptions,
180029
180087
  tryAddToSet: () => tryAddToSet,
@@ -194450,6 +194508,7 @@ if (typeof console !== "undefined") {
194450
194508
  transformSystemModule,
194451
194509
  transformTypeScript,
194452
194510
  transpile,
194511
+ transpileDeclaration,
194453
194512
  transpileModule,
194454
194513
  transpileOptionValueCompilerOptions,
194455
194514
  tryAddToSet,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.5.0-pr-58264-13",
5
+ "version": "5.5.0-pr-58299-2",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [