@typescript-deploys/pr-build 5.4.0-pr-56356-2 → 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 = [];
@@ -71263,6 +71263,11 @@ function createTypeChecker(host) {
71263
71263
  result = chooseOverload(candidates, assignableRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
71264
71264
  }
71265
71265
  if (result) {
71266
+ const returnType = calculateSignatureReturnTypeForSpecialCases(result, args);
71267
+ if (returnType) {
71268
+ result = cloneSignature(result);
71269
+ result.resolvedReturnType = returnType;
71270
+ }
71266
71271
  return result;
71267
71272
  }
71268
71273
  result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
@@ -71380,6 +71385,47 @@ function createTypeChecker(host) {
71380
71385
  }
71381
71386
  }
71382
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
+ }
71383
71429
  function addImplementationSuccessElaboration(failed, diagnostic) {
71384
71430
  var _a, _b;
71385
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";
@@ -75971,6 +75971,11 @@ function createTypeChecker(host) {
75971
75971
  result = chooseOverload(candidates, assignableRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
75972
75972
  }
75973
75973
  if (result) {
75974
+ const returnType = calculateSignatureReturnTypeForSpecialCases(result, args);
75975
+ if (returnType) {
75976
+ result = cloneSignature(result);
75977
+ result.resolvedReturnType = returnType;
75978
+ }
75974
75979
  return result;
75975
75980
  }
75976
75981
  result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
@@ -76088,6 +76093,47 @@ function createTypeChecker(host) {
76088
76093
  }
76089
76094
  }
76090
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
+ }
76091
76137
  function addImplementationSuccessElaboration(failed, diagnostic) {
76092
76138
  var _a, _b;
76093
76139
  const oldCandidatesForArgumentError = candidatesForArgumentError;
@@ -145046,13 +145092,6 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
145046
145092
  return sourceFile;
145047
145093
  }
145048
145094
  function synchronizeHostData() {
145049
- if (host.updateFromProject && !host.updateFromProjectInProgress) {
145050
- host.updateFromProject();
145051
- } else {
145052
- synchronizeHostDataWorker();
145053
- }
145054
- }
145055
- function synchronizeHostDataWorker() {
145056
145095
  var _a2, _b, _c;
145057
145096
  Debug.assert(languageServiceMode !== 2 /* Syntactic */);
145058
145097
  if (host.getProjectVersion) {
@@ -176824,8 +176863,6 @@ var Project3 = class _Project {
176824
176863
  this.createHash = maybeBind(this.projectService.host, this.projectService.host.createHash);
176825
176864
  /** @internal */
176826
176865
  this.globalCacheResolutionModuleName = ts_JsTyping_exports.nonRelativeModuleNameForTypingCache;
176827
- /** @internal */
176828
- this.updateFromProjectInProgress = false;
176829
176866
  this.projectName = projectName;
176830
176867
  this.directoryStructureHost = directoryStructureHost;
176831
176868
  this.currentDirectory = this.projectService.getNormalizedAbsolutePath(currentDirectory);
@@ -177570,10 +177607,6 @@ var Project3 = class _Project {
177570
177607
  onDiscoveredSymlink() {
177571
177608
  this.hasAddedOrRemovedSymlinks = true;
177572
177609
  }
177573
- /** @internal */
177574
- updateFromProject() {
177575
- updateProjectIfDirty(this);
177576
- }
177577
177610
  /**
177578
177611
  * Updates set of files that contribute to this project
177579
177612
  * @returns: true if set of files in the project stays the same and false - otherwise.
@@ -177732,10 +177765,8 @@ var Project3 = class _Project {
177732
177765
  this.hasInvalidatedResolutions = hasInvalidatedResolutions;
177733
177766
  this.hasInvalidatedLibResolutions = hasInvalidatedLibResolutions;
177734
177767
  this.resolutionCache.startCachingPerDirectoryResolution();
177735
- this.dirty = false;
177736
- this.updateFromProjectInProgress = true;
177737
177768
  this.program = this.languageService.getProgram();
177738
- this.updateFromProjectInProgress = false;
177769
+ this.dirty = false;
177739
177770
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "finishCachingPerDirectoryResolution");
177740
177771
  this.resolutionCache.finishCachingPerDirectoryResolution(this.program, oldProgram);
177741
177772
  (_b = tracing) == null ? void 0 : _b.pop();
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";
@@ -73736,6 +73736,11 @@ ${lanes.join("\n")}
73736
73736
  result = chooseOverload(candidates, assignableRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
73737
73737
  }
73738
73738
  if (result) {
73739
+ const returnType = calculateSignatureReturnTypeForSpecialCases(result, args);
73740
+ if (returnType) {
73741
+ result = cloneSignature(result);
73742
+ result.resolvedReturnType = returnType;
73743
+ }
73739
73744
  return result;
73740
73745
  }
73741
73746
  result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
@@ -73853,6 +73858,47 @@ ${lanes.join("\n")}
73853
73858
  }
73854
73859
  }
73855
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
+ }
73856
73902
  function addImplementationSuccessElaboration(failed, diagnostic) {
73857
73903
  var _a, _b;
73858
73904
  const oldCandidatesForArgumentError = candidatesForArgumentError;
@@ -142987,13 +143033,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
142987
143033
  return sourceFile;
142988
143034
  }
142989
143035
  function synchronizeHostData() {
142990
- if (host.updateFromProject && !host.updateFromProjectInProgress) {
142991
- host.updateFromProject();
142992
- } else {
142993
- synchronizeHostDataWorker();
142994
- }
142995
- }
142996
- function synchronizeHostDataWorker() {
142997
143036
  var _a2, _b, _c;
142998
143037
  Debug.assert(languageServiceMode !== 2 /* Syntactic */);
142999
143038
  if (host.getProjectVersion) {
@@ -174155,8 +174194,6 @@ ${options.prefix}` : "\n" : options.prefix
174155
174194
  this.createHash = maybeBind(this.projectService.host, this.projectService.host.createHash);
174156
174195
  /** @internal */
174157
174196
  this.globalCacheResolutionModuleName = ts_JsTyping_exports.nonRelativeModuleNameForTypingCache;
174158
- /** @internal */
174159
- this.updateFromProjectInProgress = false;
174160
174197
  this.projectName = projectName;
174161
174198
  this.directoryStructureHost = directoryStructureHost;
174162
174199
  this.currentDirectory = this.projectService.getNormalizedAbsolutePath(currentDirectory);
@@ -174901,10 +174938,6 @@ ${options.prefix}` : "\n" : options.prefix
174901
174938
  onDiscoveredSymlink() {
174902
174939
  this.hasAddedOrRemovedSymlinks = true;
174903
174940
  }
174904
- /** @internal */
174905
- updateFromProject() {
174906
- updateProjectIfDirty(this);
174907
- }
174908
174941
  /**
174909
174942
  * Updates set of files that contribute to this project
174910
174943
  * @returns: true if set of files in the project stays the same and false - otherwise.
@@ -175063,10 +175096,8 @@ ${options.prefix}` : "\n" : options.prefix
175063
175096
  this.hasInvalidatedResolutions = hasInvalidatedResolutions;
175064
175097
  this.hasInvalidatedLibResolutions = hasInvalidatedLibResolutions;
175065
175098
  this.resolutionCache.startCachingPerDirectoryResolution();
175066
- this.dirty = false;
175067
- this.updateFromProjectInProgress = true;
175068
175099
  this.program = this.languageService.getProgram();
175069
- this.updateFromProjectInProgress = false;
175100
+ this.dirty = false;
175070
175101
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "finishCachingPerDirectoryResolution");
175071
175102
  this.resolutionCache.finishCachingPerDirectoryResolution(this.program, oldProgram);
175072
175103
  (_b = tracing) == null ? void 0 : _b.pop();
@@ -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-56356-2",
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": "dc574fde3ad2ebc9dbad161f1b58409c91c712a1"
118
+ "gitHead": "c2e3aec94803d7185ef7c7b0f54c9af124d7a253"
119
119
  }