@typescript-deploys/pr-build 5.4.0-pr-56358-6 → 5.4.0-pr-56357-10

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-insiders.20231109`;
21
+ var version = `${versionMajorMinor}.0-insiders.20231110`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -40404,14 +40404,9 @@ function createBinder() {
40404
40404
  const clauses = node.clauses;
40405
40405
  const isNarrowingSwitch = node.parent.expression.kind === 112 /* TrueKeyword */ || isNarrowingExpression(node.parent.expression);
40406
40406
  let fallthroughFlow = unreachableFlow;
40407
- let afterPreviousClauseFlow;
40408
40407
  for (let i = 0; i < clauses.length; i++) {
40409
40408
  const clauseStart = i;
40410
40409
  while (!clauses[i].statements.length && i + 1 < clauses.length) {
40411
- if (afterPreviousClauseFlow && afterPreviousClauseFlow === unreachableFlow) {
40412
- currentFlow = preSwitchCaseFlow;
40413
- afterPreviousClauseFlow = void 0;
40414
- }
40415
40410
  bind(clauses[i]);
40416
40411
  i++;
40417
40412
  }
@@ -40421,7 +40416,7 @@ function createBinder() {
40421
40416
  currentFlow = finishFlowLabel(preCaseLabel);
40422
40417
  const clause = clauses[i];
40423
40418
  bind(clause);
40424
- fallthroughFlow = afterPreviousClauseFlow = currentFlow;
40419
+ fallthroughFlow = currentFlow;
40425
40420
  if (!(currentFlow.flags & 1 /* Unreachable */) && i !== clauses.length - 1 && options.noFallthroughCasesInSwitch) {
40426
40421
  clause.fallthroughFlowNode = currentFlow;
40427
40422
  }
@@ -71268,6 +71263,11 @@ function createTypeChecker(host) {
71268
71263
  result = chooseOverload(candidates, assignableRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
71269
71264
  }
71270
71265
  if (result) {
71266
+ const returnType = calculateSignatureReturnTypeForSpecialCases(result, args);
71267
+ if (returnType) {
71268
+ result = cloneSignature(result);
71269
+ result.resolvedReturnType = returnType;
71270
+ }
71271
71271
  return result;
71272
71272
  }
71273
71273
  result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
@@ -71385,6 +71385,47 @@ function createTypeChecker(host) {
71385
71385
  }
71386
71386
  }
71387
71387
  return result;
71388
+ function calculateSignatureReturnTypeForSpecialCases(signature, args2) {
71389
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
71390
+ if (args2.length >= 1) {
71391
+ if (((_b = (_a = signature.declaration) == null ? void 0 : _a.symbol) == null ? void 0 : _b.escapedName) === "filter" && (((_e = (_d = (_c = signature.declaration) == null ? void 0 : _c.symbol) == null ? void 0 : _d.parent) == null ? void 0 : _e.escapedName) === "Array" || ((_h = (_g = (_f = signature.declaration) == null ? void 0 : _f.symbol) == null ? void 0 : _g.parent) == null ? void 0 : _h.escapedName) === "ReadonlyArray")) {
71392
+ const arg0Type = getTypeOfExpression(args2[0]);
71393
+ if (((_i = arg0Type.symbol) == null ? void 0 : _i.escapedName) === "BooleanConstructor") {
71394
+ let returnType = (_j = signature.mapper) == null ? void 0 : _j.targets[1];
71395
+ if (returnType) {
71396
+ const nonFalsieArrayTypesOut = [];
71397
+ forEachType(returnType, (at) => {
71398
+ let elemType;
71399
+ if (isTupleType(at)) {
71400
+ elemType = getUnionType(getElementTypes(at));
71401
+ } else if (isTupleLikeType(at)) {
71402
+ nonFalsieArrayTypesOut.push(at);
71403
+ return;
71404
+ } else {
71405
+ elemType = getElementTypeOfArrayType(at) || anyType;
71406
+ }
71407
+ const nonFalsieElemTypes = [];
71408
+ nonFalsieElemTypes.push(filterType(
71409
+ elemType,
71410
+ (t) => {
71411
+ const facts = getTypeFacts(t, 4194304 /* Truthy */ | 8388608 /* Falsy */);
71412
+ if (facts === 8388608 /* Falsy */) {
71413
+ return false;
71414
+ } else {
71415
+ return true;
71416
+ }
71417
+ }
71418
+ ));
71419
+ const atout = createArrayType(getUnionType(nonFalsieElemTypes));
71420
+ nonFalsieArrayTypesOut.push(atout);
71421
+ });
71422
+ returnType = getUnionType(nonFalsieArrayTypesOut);
71423
+ return returnType;
71424
+ }
71425
+ }
71426
+ }
71427
+ }
71428
+ }
71388
71429
  function addImplementationSuccessElaboration(failed, diagnostic) {
71389
71430
  var _a, _b;
71390
71431
  const oldCandidatesForArgumentError = candidatesForArgumentError;
package/lib/tsserver.js CHANGED
@@ -2330,7 +2330,7 @@ module.exports = __toCommonJS(server_exports);
2330
2330
 
2331
2331
  // src/compiler/corePublic.ts
2332
2332
  var versionMajorMinor = "5.4";
2333
- var version = `${versionMajorMinor}.0-insiders.20231109`;
2333
+ var version = `${versionMajorMinor}.0-insiders.20231110`;
2334
2334
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2335
2335
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2336
2336
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -45067,14 +45067,9 @@ function createBinder() {
45067
45067
  const clauses = node.clauses;
45068
45068
  const isNarrowingSwitch = node.parent.expression.kind === 112 /* TrueKeyword */ || isNarrowingExpression(node.parent.expression);
45069
45069
  let fallthroughFlow = unreachableFlow;
45070
- let afterPreviousClauseFlow;
45071
45070
  for (let i = 0; i < clauses.length; i++) {
45072
45071
  const clauseStart = i;
45073
45072
  while (!clauses[i].statements.length && i + 1 < clauses.length) {
45074
- if (afterPreviousClauseFlow && afterPreviousClauseFlow === unreachableFlow) {
45075
- currentFlow = preSwitchCaseFlow;
45076
- afterPreviousClauseFlow = void 0;
45077
- }
45078
45073
  bind(clauses[i]);
45079
45074
  i++;
45080
45075
  }
@@ -45084,7 +45079,7 @@ function createBinder() {
45084
45079
  currentFlow = finishFlowLabel(preCaseLabel);
45085
45080
  const clause = clauses[i];
45086
45081
  bind(clause);
45087
- fallthroughFlow = afterPreviousClauseFlow = currentFlow;
45082
+ fallthroughFlow = currentFlow;
45088
45083
  if (!(currentFlow.flags & 1 /* Unreachable */) && i !== clauses.length - 1 && options.noFallthroughCasesInSwitch) {
45089
45084
  clause.fallthroughFlowNode = currentFlow;
45090
45085
  }
@@ -75976,6 +75971,11 @@ function createTypeChecker(host) {
75976
75971
  result = chooseOverload(candidates, assignableRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
75977
75972
  }
75978
75973
  if (result) {
75974
+ const returnType = calculateSignatureReturnTypeForSpecialCases(result, args);
75975
+ if (returnType) {
75976
+ result = cloneSignature(result);
75977
+ result.resolvedReturnType = returnType;
75978
+ }
75979
75979
  return result;
75980
75980
  }
75981
75981
  result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
@@ -76093,6 +76093,47 @@ function createTypeChecker(host) {
76093
76093
  }
76094
76094
  }
76095
76095
  return result;
76096
+ function calculateSignatureReturnTypeForSpecialCases(signature, args2) {
76097
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
76098
+ if (args2.length >= 1) {
76099
+ if (((_b = (_a = signature.declaration) == null ? void 0 : _a.symbol) == null ? void 0 : _b.escapedName) === "filter" && (((_e = (_d = (_c = signature.declaration) == null ? void 0 : _c.symbol) == null ? void 0 : _d.parent) == null ? void 0 : _e.escapedName) === "Array" || ((_h = (_g = (_f = signature.declaration) == null ? void 0 : _f.symbol) == null ? void 0 : _g.parent) == null ? void 0 : _h.escapedName) === "ReadonlyArray")) {
76100
+ const arg0Type = getTypeOfExpression(args2[0]);
76101
+ if (((_i = arg0Type.symbol) == null ? void 0 : _i.escapedName) === "BooleanConstructor") {
76102
+ let returnType = (_j = signature.mapper) == null ? void 0 : _j.targets[1];
76103
+ if (returnType) {
76104
+ const nonFalsieArrayTypesOut = [];
76105
+ forEachType(returnType, (at) => {
76106
+ let elemType;
76107
+ if (isTupleType(at)) {
76108
+ elemType = getUnionType(getElementTypes(at));
76109
+ } else if (isTupleLikeType(at)) {
76110
+ nonFalsieArrayTypesOut.push(at);
76111
+ return;
76112
+ } else {
76113
+ elemType = getElementTypeOfArrayType(at) || anyType;
76114
+ }
76115
+ const nonFalsieElemTypes = [];
76116
+ nonFalsieElemTypes.push(filterType(
76117
+ elemType,
76118
+ (t) => {
76119
+ const facts = getTypeFacts(t, 4194304 /* Truthy */ | 8388608 /* Falsy */);
76120
+ if (facts === 8388608 /* Falsy */) {
76121
+ return false;
76122
+ } else {
76123
+ return true;
76124
+ }
76125
+ }
76126
+ ));
76127
+ const atout = createArrayType(getUnionType(nonFalsieElemTypes));
76128
+ nonFalsieArrayTypesOut.push(atout);
76129
+ });
76130
+ returnType = getUnionType(nonFalsieArrayTypesOut);
76131
+ return returnType;
76132
+ }
76133
+ }
76134
+ }
76135
+ }
76136
+ }
76096
76137
  function addImplementationSuccessElaboration(failed, diagnostic) {
76097
76138
  var _a, _b;
76098
76139
  const oldCandidatesForArgumentError = candidatesForArgumentError;
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.4";
38
- version = `${versionMajorMinor}.0-insiders.20231109`;
38
+ version = `${versionMajorMinor}.0-insiders.20231110`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -42912,14 +42912,9 @@ ${lanes.join("\n")}
42912
42912
  const clauses = node.clauses;
42913
42913
  const isNarrowingSwitch = node.parent.expression.kind === 112 /* TrueKeyword */ || isNarrowingExpression(node.parent.expression);
42914
42914
  let fallthroughFlow = unreachableFlow;
42915
- let afterPreviousClauseFlow;
42916
42915
  for (let i = 0; i < clauses.length; i++) {
42917
42916
  const clauseStart = i;
42918
42917
  while (!clauses[i].statements.length && i + 1 < clauses.length) {
42919
- if (afterPreviousClauseFlow && afterPreviousClauseFlow === unreachableFlow) {
42920
- currentFlow = preSwitchCaseFlow;
42921
- afterPreviousClauseFlow = void 0;
42922
- }
42923
42918
  bind(clauses[i]);
42924
42919
  i++;
42925
42920
  }
@@ -42929,7 +42924,7 @@ ${lanes.join("\n")}
42929
42924
  currentFlow = finishFlowLabel(preCaseLabel);
42930
42925
  const clause = clauses[i];
42931
42926
  bind(clause);
42932
- fallthroughFlow = afterPreviousClauseFlow = currentFlow;
42927
+ fallthroughFlow = currentFlow;
42933
42928
  if (!(currentFlow.flags & 1 /* Unreachable */) && i !== clauses.length - 1 && options.noFallthroughCasesInSwitch) {
42934
42929
  clause.fallthroughFlowNode = currentFlow;
42935
42930
  }
@@ -73741,6 +73736,11 @@ ${lanes.join("\n")}
73741
73736
  result = chooseOverload(candidates, assignableRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
73742
73737
  }
73743
73738
  if (result) {
73739
+ const returnType = calculateSignatureReturnTypeForSpecialCases(result, args);
73740
+ if (returnType) {
73741
+ result = cloneSignature(result);
73742
+ result.resolvedReturnType = returnType;
73743
+ }
73744
73744
  return result;
73745
73745
  }
73746
73746
  result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
@@ -73858,6 +73858,47 @@ ${lanes.join("\n")}
73858
73858
  }
73859
73859
  }
73860
73860
  return result;
73861
+ function calculateSignatureReturnTypeForSpecialCases(signature, args2) {
73862
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
73863
+ if (args2.length >= 1) {
73864
+ if (((_b = (_a = signature.declaration) == null ? void 0 : _a.symbol) == null ? void 0 : _b.escapedName) === "filter" && (((_e = (_d = (_c = signature.declaration) == null ? void 0 : _c.symbol) == null ? void 0 : _d.parent) == null ? void 0 : _e.escapedName) === "Array" || ((_h = (_g = (_f = signature.declaration) == null ? void 0 : _f.symbol) == null ? void 0 : _g.parent) == null ? void 0 : _h.escapedName) === "ReadonlyArray")) {
73865
+ const arg0Type = getTypeOfExpression(args2[0]);
73866
+ if (((_i = arg0Type.symbol) == null ? void 0 : _i.escapedName) === "BooleanConstructor") {
73867
+ let returnType = (_j = signature.mapper) == null ? void 0 : _j.targets[1];
73868
+ if (returnType) {
73869
+ const nonFalsieArrayTypesOut = [];
73870
+ forEachType(returnType, (at) => {
73871
+ let elemType;
73872
+ if (isTupleType(at)) {
73873
+ elemType = getUnionType(getElementTypes(at));
73874
+ } else if (isTupleLikeType(at)) {
73875
+ nonFalsieArrayTypesOut.push(at);
73876
+ return;
73877
+ } else {
73878
+ elemType = getElementTypeOfArrayType(at) || anyType;
73879
+ }
73880
+ const nonFalsieElemTypes = [];
73881
+ nonFalsieElemTypes.push(filterType(
73882
+ elemType,
73883
+ (t) => {
73884
+ const facts = getTypeFacts(t, 4194304 /* Truthy */ | 8388608 /* Falsy */);
73885
+ if (facts === 8388608 /* Falsy */) {
73886
+ return false;
73887
+ } else {
73888
+ return true;
73889
+ }
73890
+ }
73891
+ ));
73892
+ const atout = createArrayType(getUnionType(nonFalsieElemTypes));
73893
+ nonFalsieArrayTypesOut.push(atout);
73894
+ });
73895
+ returnType = getUnionType(nonFalsieArrayTypesOut);
73896
+ return returnType;
73897
+ }
73898
+ }
73899
+ }
73900
+ }
73901
+ }
73861
73902
  function addImplementationSuccessElaboration(failed, diagnostic) {
73862
73903
  var _a, _b;
73863
73904
  const oldCandidatesForArgumentError = candidatesForArgumentError;
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.4";
57
- var version = `${versionMajorMinor}.0-insiders.20231109`;
57
+ var version = `${versionMajorMinor}.0-insiders.20231110`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
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.4.0-pr-56358-6",
5
+ "version": "5.4.0-pr-56357-10",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -115,5 +115,5 @@
115
115
  "node": "20.1.0",
116
116
  "npm": "8.19.4"
117
117
  },
118
- "gitHead": "2f4cd21b78f16a6222d1c9b3eb2834385c7d8986"
118
+ "gitHead": "c2e3aec94803d7185ef7c7b0f54c9af124d7a253"
119
119
  }