typescript 5.3.0-dev.20230918 → 5.3.0-dev.20230919

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.3";
21
- var version = `${versionMajorMinor}.0-dev.20230918`;
21
+ var version = `${versionMajorMinor}.0-dev.20230919`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -40242,7 +40242,7 @@ function createBinder() {
40242
40242
  }
40243
40243
  function bindCaseBlock(node) {
40244
40244
  const clauses = node.clauses;
40245
- const isNarrowingSwitch = isNarrowingExpression(node.parent.expression);
40245
+ const isNarrowingSwitch = node.parent.expression.kind === 112 /* TrueKeyword */ || isNarrowingExpression(node.parent.expression);
40246
40246
  let fallthroughFlow = unreachableFlow;
40247
40247
  for (let i = 0; i < clauses.length; i++) {
40248
40248
  const clauseStart = i;
@@ -65549,6 +65549,17 @@ function createTypeChecker(host) {
65549
65549
  type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
65550
65550
  } else if (expr.kind === 221 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
65551
65551
  type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
65552
+ } else if (expr.kind === 112 /* TrueKeyword */) {
65553
+ const clause = flow.switchStatement.caseBlock.clauses.find((_, index) => index === flow.clauseStart);
65554
+ const clauseExpression = clause && clause.kind === 296 /* CaseClause */ ? clause.expression : void 0;
65555
+ if (clauseExpression) {
65556
+ type = narrowType(
65557
+ type,
65558
+ clauseExpression,
65559
+ /*assumeTrue*/
65560
+ true
65561
+ );
65562
+ }
65552
65563
  } else {
65553
65564
  if (strictNullChecks) {
65554
65565
  if (optionalChainContainsReference(expr, reference)) {
package/lib/tsserver.js CHANGED
@@ -2328,7 +2328,7 @@ module.exports = __toCommonJS(server_exports);
2328
2328
 
2329
2329
  // src/compiler/corePublic.ts
2330
2330
  var versionMajorMinor = "5.3";
2331
- var version = `${versionMajorMinor}.0-dev.20230918`;
2331
+ var version = `${versionMajorMinor}.0-dev.20230919`;
2332
2332
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2333
2333
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2334
2334
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -44897,7 +44897,7 @@ function createBinder() {
44897
44897
  }
44898
44898
  function bindCaseBlock(node) {
44899
44899
  const clauses = node.clauses;
44900
- const isNarrowingSwitch = isNarrowingExpression(node.parent.expression);
44900
+ const isNarrowingSwitch = node.parent.expression.kind === 112 /* TrueKeyword */ || isNarrowingExpression(node.parent.expression);
44901
44901
  let fallthroughFlow = unreachableFlow;
44902
44902
  for (let i = 0; i < clauses.length; i++) {
44903
44903
  const clauseStart = i;
@@ -70249,6 +70249,17 @@ function createTypeChecker(host) {
70249
70249
  type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
70250
70250
  } else if (expr.kind === 221 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
70251
70251
  type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
70252
+ } else if (expr.kind === 112 /* TrueKeyword */) {
70253
+ const clause = flow.switchStatement.caseBlock.clauses.find((_, index) => index === flow.clauseStart);
70254
+ const clauseExpression = clause && clause.kind === 296 /* CaseClause */ ? clause.expression : void 0;
70255
+ if (clauseExpression) {
70256
+ type = narrowType(
70257
+ type,
70258
+ clauseExpression,
70259
+ /*assumeTrue*/
70260
+ true
70261
+ );
70262
+ }
70252
70263
  } else {
70253
70264
  if (strictNullChecks) {
70254
70265
  if (optionalChainContainsReference(expr, reference)) {
@@ -151098,7 +151109,6 @@ function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceF
151098
151109
  if (aliasDeclaration.isTypeOnly) {
151099
151110
  const sortKind = ts_OrganizeImports_exports.detectImportSpecifierSorting(aliasDeclaration.parent.elements, preferences);
151100
151111
  if (aliasDeclaration.parent.elements.length > 1 && sortKind) {
151101
- changes.delete(sourceFile, aliasDeclaration);
151102
151112
  const newSpecifier = factory.updateImportSpecifier(
151103
151113
  aliasDeclaration,
151104
151114
  /*isTypeOnly*/
@@ -151108,10 +151118,13 @@ function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceF
151108
151118
  );
151109
151119
  const comparer = ts_OrganizeImports_exports.getOrganizeImportsComparer(preferences, sortKind === 2 /* CaseInsensitive */);
151110
151120
  const insertionIndex = ts_OrganizeImports_exports.getImportSpecifierInsertionIndex(aliasDeclaration.parent.elements, newSpecifier, comparer);
151111
- changes.insertImportSpecifierAtIndex(sourceFile, newSpecifier, aliasDeclaration.parent, insertionIndex);
151112
- } else {
151113
- changes.deleteRange(sourceFile, aliasDeclaration.getFirstToken());
151121
+ if (aliasDeclaration.parent.elements.indexOf(aliasDeclaration) !== insertionIndex) {
151122
+ changes.delete(sourceFile, aliasDeclaration);
151123
+ changes.insertImportSpecifierAtIndex(sourceFile, newSpecifier, aliasDeclaration.parent, insertionIndex);
151124
+ return aliasDeclaration;
151125
+ }
151114
151126
  }
151127
+ changes.deleteRange(sourceFile, aliasDeclaration.getFirstToken());
151115
151128
  return aliasDeclaration;
151116
151129
  } else {
151117
151130
  Debug.assert(aliasDeclaration.parent.parent.isTypeOnly);
package/lib/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.3";
38
- version = `${versionMajorMinor}.0-dev.20230918`;
38
+ version = `${versionMajorMinor}.0-dev.20230919`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -42744,7 +42744,7 @@ ${lanes.join("\n")}
42744
42744
  }
42745
42745
  function bindCaseBlock(node) {
42746
42746
  const clauses = node.clauses;
42747
- const isNarrowingSwitch = isNarrowingExpression(node.parent.expression);
42747
+ const isNarrowingSwitch = node.parent.expression.kind === 112 /* TrueKeyword */ || isNarrowingExpression(node.parent.expression);
42748
42748
  let fallthroughFlow = unreachableFlow;
42749
42749
  for (let i = 0; i < clauses.length; i++) {
42750
42750
  const clauseStart = i;
@@ -68015,6 +68015,17 @@ ${lanes.join("\n")}
68015
68015
  type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
68016
68016
  } else if (expr.kind === 221 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
68017
68017
  type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
68018
+ } else if (expr.kind === 112 /* TrueKeyword */) {
68019
+ const clause = flow.switchStatement.caseBlock.clauses.find((_, index) => index === flow.clauseStart);
68020
+ const clauseExpression = clause && clause.kind === 296 /* CaseClause */ ? clause.expression : void 0;
68021
+ if (clauseExpression) {
68022
+ type = narrowType(
68023
+ type,
68024
+ clauseExpression,
68025
+ /*assumeTrue*/
68026
+ true
68027
+ );
68028
+ }
68018
68029
  } else {
68019
68030
  if (strictNullChecks) {
68020
68031
  if (optionalChainContainsReference(expr, reference)) {
@@ -149825,7 +149836,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149825
149836
  if (aliasDeclaration.isTypeOnly) {
149826
149837
  const sortKind = ts_OrganizeImports_exports.detectImportSpecifierSorting(aliasDeclaration.parent.elements, preferences);
149827
149838
  if (aliasDeclaration.parent.elements.length > 1 && sortKind) {
149828
- changes.delete(sourceFile, aliasDeclaration);
149829
149839
  const newSpecifier = factory.updateImportSpecifier(
149830
149840
  aliasDeclaration,
149831
149841
  /*isTypeOnly*/
@@ -149835,10 +149845,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149835
149845
  );
149836
149846
  const comparer = ts_OrganizeImports_exports.getOrganizeImportsComparer(preferences, sortKind === 2 /* CaseInsensitive */);
149837
149847
  const insertionIndex = ts_OrganizeImports_exports.getImportSpecifierInsertionIndex(aliasDeclaration.parent.elements, newSpecifier, comparer);
149838
- changes.insertImportSpecifierAtIndex(sourceFile, newSpecifier, aliasDeclaration.parent, insertionIndex);
149839
- } else {
149840
- changes.deleteRange(sourceFile, aliasDeclaration.getFirstToken());
149848
+ if (aliasDeclaration.parent.elements.indexOf(aliasDeclaration) !== insertionIndex) {
149849
+ changes.delete(sourceFile, aliasDeclaration);
149850
+ changes.insertImportSpecifierAtIndex(sourceFile, newSpecifier, aliasDeclaration.parent, insertionIndex);
149851
+ return aliasDeclaration;
149852
+ }
149841
149853
  }
149854
+ changes.deleteRange(sourceFile, aliasDeclaration.getFirstToken());
149842
149855
  return aliasDeclaration;
149843
149856
  } else {
149844
149857
  Debug.assert(aliasDeclaration.parent.parent.isTypeOnly);
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.3";
57
- var version = `${versionMajorMinor}.0-dev.20230918`;
57
+ var version = `${versionMajorMinor}.0-dev.20230919`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.3.0-dev.20230918",
5
+ "version": "5.3.0-dev.20230919",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -113,5 +113,5 @@
113
113
  "node": "20.1.0",
114
114
  "npm": "8.19.4"
115
115
  },
116
- "gitHead": "686cb1b63c82e5eee4cd9f8bbdbcf657a4815ff7"
116
+ "gitHead": "7d9399e353c1b770ab1b5c859c98e014cd3fda03"
117
117
  }