@typescript-deploys/pr-build 5.8.0-pr-61144-2 → 5.8.0-pr-60434-6
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 +52 -3
- package/lib/typescript.js +52 -3
- package/package.json +2 -2
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.8";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20250212`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -72343,6 +72343,50 @@ function createTypeChecker(host) {
|
|
|
72343
72343
|
)
|
|
72344
72344
|
);
|
|
72345
72345
|
}
|
|
72346
|
+
function discriminateContextualTypeByArrayElements(node, contextualType) {
|
|
72347
|
+
const key = `D${getNodeId(node)},${getTypeId(contextualType)}`;
|
|
72348
|
+
const cachedType = getCachedType(key);
|
|
72349
|
+
if (cachedType) return cachedType;
|
|
72350
|
+
const isIndexPropertyLike = (property) => /^[-+]?\d+$/.test(property.escapedName);
|
|
72351
|
+
const hasIndexPropertyOutOfRange = (type, length2) => some(getPropertiesOfType(type), (p) => {
|
|
72352
|
+
if (p.flags & 16777216 /* Optional */ || !isIndexPropertyLike(p)) return false;
|
|
72353
|
+
const index = +p.escapedName;
|
|
72354
|
+
return index < 0 || index >= length2;
|
|
72355
|
+
});
|
|
72356
|
+
const hasIndexPropertyInRange = (type, length2) => some(getPropertiesOfType(type), (p) => {
|
|
72357
|
+
if (!isIndexPropertyLike(p)) return false;
|
|
72358
|
+
const index = +p.escapedName;
|
|
72359
|
+
return index >= 0 || index < length2;
|
|
72360
|
+
});
|
|
72361
|
+
const elementsLength = node.elements.length;
|
|
72362
|
+
const filteredType = filterType(contextualType, (type) => {
|
|
72363
|
+
if (isTupleType(type)) {
|
|
72364
|
+
return elementsLength >= type.target.minLength && (!!(type.target.combinedFlags & 12 /* Variable */) || elementsLength <= type.target.fixedLength);
|
|
72365
|
+
}
|
|
72366
|
+
return !hasIndexPropertyOutOfRange(type, elementsLength);
|
|
72367
|
+
});
|
|
72368
|
+
if (filteredType.flags & 131072 /* Never */) return setCachedType(key, contextualType);
|
|
72369
|
+
if (!(filteredType.flags & 1048576 /* Union */)) {
|
|
72370
|
+
return setCachedType(
|
|
72371
|
+
key,
|
|
72372
|
+
isTupleType(filteredType) || hasIndexPropertyInRange(filteredType, elementsLength) ? filteredType : contextualType
|
|
72373
|
+
);
|
|
72374
|
+
}
|
|
72375
|
+
return setCachedType(
|
|
72376
|
+
key,
|
|
72377
|
+
discriminateTypeByDiscriminableItems(
|
|
72378
|
+
filteredType,
|
|
72379
|
+
filter(
|
|
72380
|
+
map(node.elements, (element, index) => {
|
|
72381
|
+
const name = "" + index;
|
|
72382
|
+
return isPossiblyDiscriminantValue(element) && isDiscriminantProperty(filteredType, name) ? [() => getContextFreeTypeOfExpression(element), name] : void 0;
|
|
72383
|
+
}),
|
|
72384
|
+
(discriminator) => !!discriminator
|
|
72385
|
+
),
|
|
72386
|
+
isTypeAssignableTo
|
|
72387
|
+
)
|
|
72388
|
+
);
|
|
72389
|
+
}
|
|
72346
72390
|
function getApparentTypeOfContextualType(node, contextFlags) {
|
|
72347
72391
|
const contextualType = isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node, contextFlags) : getContextualType(node, contextFlags);
|
|
72348
72392
|
const instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
|
|
@@ -72357,7 +72401,12 @@ function createTypeChecker(host) {
|
|
|
72357
72401
|
/*noReductions*/
|
|
72358
72402
|
true
|
|
72359
72403
|
);
|
|
72360
|
-
|
|
72404
|
+
if (apparentType.flags & 1048576 /* Union */) {
|
|
72405
|
+
if (isObjectLiteralExpression(node)) return discriminateContextualTypeByObjectMembers(node, apparentType);
|
|
72406
|
+
if (isJsxAttributes(node)) return discriminateContextualTypeByJSXAttributes(node, apparentType);
|
|
72407
|
+
if (isArrayLiteralExpression(node)) return discriminateContextualTypeByArrayElements(node, apparentType);
|
|
72408
|
+
}
|
|
72409
|
+
return apparentType;
|
|
72361
72410
|
}
|
|
72362
72411
|
}
|
|
72363
72412
|
function instantiateContextualType(contextualType, node, contextFlags) {
|
|
@@ -111874,7 +111923,7 @@ function transformECMAScriptModule(context) {
|
|
|
111874
111923
|
if (node === (importsAndRequiresToRewriteOrShim == null ? void 0 : importsAndRequiresToRewriteOrShim[0])) {
|
|
111875
111924
|
return visitImportOrRequireCall(importsAndRequiresToRewriteOrShim.shift());
|
|
111876
111925
|
}
|
|
111877
|
-
|
|
111926
|
+
// fallthrough
|
|
111878
111927
|
default:
|
|
111879
111928
|
if ((importsAndRequiresToRewriteOrShim == null ? void 0 : importsAndRequiresToRewriteOrShim.length) && rangeContainsRange(node, importsAndRequiresToRewriteOrShim[0])) {
|
|
111880
111929
|
return visitEachChild(node, visitor, context);
|
package/lib/typescript.js
CHANGED
|
@@ -2285,7 +2285,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2285
2285
|
|
|
2286
2286
|
// src/compiler/corePublic.ts
|
|
2287
2287
|
var versionMajorMinor = "5.8";
|
|
2288
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2288
|
+
var version = `${versionMajorMinor}.0-insiders.20250212`;
|
|
2289
2289
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2290
2290
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2291
2291
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -76953,6 +76953,50 @@ function createTypeChecker(host) {
|
|
|
76953
76953
|
)
|
|
76954
76954
|
);
|
|
76955
76955
|
}
|
|
76956
|
+
function discriminateContextualTypeByArrayElements(node, contextualType) {
|
|
76957
|
+
const key = `D${getNodeId(node)},${getTypeId(contextualType)}`;
|
|
76958
|
+
const cachedType = getCachedType(key);
|
|
76959
|
+
if (cachedType) return cachedType;
|
|
76960
|
+
const isIndexPropertyLike = (property) => /^[-+]?\d+$/.test(property.escapedName);
|
|
76961
|
+
const hasIndexPropertyOutOfRange = (type, length2) => some(getPropertiesOfType(type), (p) => {
|
|
76962
|
+
if (p.flags & 16777216 /* Optional */ || !isIndexPropertyLike(p)) return false;
|
|
76963
|
+
const index = +p.escapedName;
|
|
76964
|
+
return index < 0 || index >= length2;
|
|
76965
|
+
});
|
|
76966
|
+
const hasIndexPropertyInRange = (type, length2) => some(getPropertiesOfType(type), (p) => {
|
|
76967
|
+
if (!isIndexPropertyLike(p)) return false;
|
|
76968
|
+
const index = +p.escapedName;
|
|
76969
|
+
return index >= 0 || index < length2;
|
|
76970
|
+
});
|
|
76971
|
+
const elementsLength = node.elements.length;
|
|
76972
|
+
const filteredType = filterType(contextualType, (type) => {
|
|
76973
|
+
if (isTupleType(type)) {
|
|
76974
|
+
return elementsLength >= type.target.minLength && (!!(type.target.combinedFlags & 12 /* Variable */) || elementsLength <= type.target.fixedLength);
|
|
76975
|
+
}
|
|
76976
|
+
return !hasIndexPropertyOutOfRange(type, elementsLength);
|
|
76977
|
+
});
|
|
76978
|
+
if (filteredType.flags & 131072 /* Never */) return setCachedType(key, contextualType);
|
|
76979
|
+
if (!(filteredType.flags & 1048576 /* Union */)) {
|
|
76980
|
+
return setCachedType(
|
|
76981
|
+
key,
|
|
76982
|
+
isTupleType(filteredType) || hasIndexPropertyInRange(filteredType, elementsLength) ? filteredType : contextualType
|
|
76983
|
+
);
|
|
76984
|
+
}
|
|
76985
|
+
return setCachedType(
|
|
76986
|
+
key,
|
|
76987
|
+
discriminateTypeByDiscriminableItems(
|
|
76988
|
+
filteredType,
|
|
76989
|
+
filter(
|
|
76990
|
+
map(node.elements, (element, index) => {
|
|
76991
|
+
const name = "" + index;
|
|
76992
|
+
return isPossiblyDiscriminantValue(element) && isDiscriminantProperty(filteredType, name) ? [() => getContextFreeTypeOfExpression(element), name] : void 0;
|
|
76993
|
+
}),
|
|
76994
|
+
(discriminator) => !!discriminator
|
|
76995
|
+
),
|
|
76996
|
+
isTypeAssignableTo
|
|
76997
|
+
)
|
|
76998
|
+
);
|
|
76999
|
+
}
|
|
76956
77000
|
function getApparentTypeOfContextualType(node, contextFlags) {
|
|
76957
77001
|
const contextualType = isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node, contextFlags) : getContextualType2(node, contextFlags);
|
|
76958
77002
|
const instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
|
|
@@ -76967,7 +77011,12 @@ function createTypeChecker(host) {
|
|
|
76967
77011
|
/*noReductions*/
|
|
76968
77012
|
true
|
|
76969
77013
|
);
|
|
76970
|
-
|
|
77014
|
+
if (apparentType.flags & 1048576 /* Union */) {
|
|
77015
|
+
if (isObjectLiteralExpression(node)) return discriminateContextualTypeByObjectMembers(node, apparentType);
|
|
77016
|
+
if (isJsxAttributes(node)) return discriminateContextualTypeByJSXAttributes(node, apparentType);
|
|
77017
|
+
if (isArrayLiteralExpression(node)) return discriminateContextualTypeByArrayElements(node, apparentType);
|
|
77018
|
+
}
|
|
77019
|
+
return apparentType;
|
|
76971
77020
|
}
|
|
76972
77021
|
}
|
|
76973
77022
|
function instantiateContextualType(contextualType, node, contextFlags) {
|
|
@@ -116666,7 +116715,7 @@ function transformECMAScriptModule(context) {
|
|
|
116666
116715
|
if (node === (importsAndRequiresToRewriteOrShim == null ? void 0 : importsAndRequiresToRewriteOrShim[0])) {
|
|
116667
116716
|
return visitImportOrRequireCall(importsAndRequiresToRewriteOrShim.shift());
|
|
116668
116717
|
}
|
|
116669
|
-
|
|
116718
|
+
// fallthrough
|
|
116670
116719
|
default:
|
|
116671
116720
|
if ((importsAndRequiresToRewriteOrShim == null ? void 0 : importsAndRequiresToRewriteOrShim.length) && rangeContainsRange(node, importsAndRequiresToRewriteOrShim[0])) {
|
|
116672
116721
|
return visitEachChild(node, visitor, context);
|
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.8.0-pr-
|
|
5
|
+
"version": "5.8.0-pr-60434-6",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"chokidar": "^3.6.0",
|
|
63
63
|
"diff": "^5.2.0",
|
|
64
64
|
"dprint": "^0.47.6",
|
|
65
|
-
"esbuild": "^0.
|
|
65
|
+
"esbuild": "^0.25.0",
|
|
66
66
|
"eslint": "^9.17.0",
|
|
67
67
|
"eslint-formatter-autolinkable-stylish": "^1.4.0",
|
|
68
68
|
"eslint-plugin-regexp": "^2.7.0",
|