@typescript-deploys/pr-build 5.0.0-pr-52836-9 → 5.0.0-pr-52836-22
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 +36 -10
- package/lib/tsserver.js +36 -10
- package/lib/tsserverlibrary.js +36 -10
- package/lib/typescript.js +36 -10
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -56413,6 +56413,11 @@ function createTypeChecker(host) {
|
|
|
56413
56413
|
}
|
|
56414
56414
|
function createTemplateLiteralType(texts, types) {
|
|
56415
56415
|
const type = createType(134217728 /* TemplateLiteral */);
|
|
56416
|
+
type.objectFlags = getPropagatingFlagsOfTypes(
|
|
56417
|
+
types,
|
|
56418
|
+
/*excludeKinds*/
|
|
56419
|
+
98304 /* Nullable */
|
|
56420
|
+
);
|
|
56416
56421
|
type.texts = texts;
|
|
56417
56422
|
type.types = types;
|
|
56418
56423
|
return type;
|
|
@@ -56727,7 +56732,7 @@ function createTypeChecker(host) {
|
|
|
56727
56732
|
return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */);
|
|
56728
56733
|
}
|
|
56729
56734
|
function getGenericObjectFlags(type) {
|
|
56730
|
-
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
56735
|
+
if (type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */)) {
|
|
56731
56736
|
if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) {
|
|
56732
56737
|
type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0);
|
|
56733
56738
|
}
|
|
@@ -56739,7 +56744,7 @@ function createTypeChecker(host) {
|
|
|
56739
56744
|
}
|
|
56740
56745
|
return type.objectFlags & 12582912 /* IsGenericType */;
|
|
56741
56746
|
}
|
|
56742
|
-
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ |
|
|
56747
|
+
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
|
|
56743
56748
|
}
|
|
56744
56749
|
function getSimplifiedType(type, writing) {
|
|
56745
56750
|
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
@@ -61917,7 +61922,7 @@ function createTypeChecker(host) {
|
|
|
61917
61922
|
const restType = getRestTypeOfTupleType(type);
|
|
61918
61923
|
return restType && createArrayType(restType);
|
|
61919
61924
|
}
|
|
61920
|
-
function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false) {
|
|
61925
|
+
function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false, noReductions = false) {
|
|
61921
61926
|
const length2 = getTypeReferenceArity(type) - endSkipCount;
|
|
61922
61927
|
if (index < length2) {
|
|
61923
61928
|
const typeArguments = getTypeArguments(type);
|
|
@@ -61926,7 +61931,7 @@ function createTypeChecker(host) {
|
|
|
61926
61931
|
const t = typeArguments[i];
|
|
61927
61932
|
elementTypes.push(type.target.elementFlags[i] & 8 /* Variadic */ ? getIndexedAccessType(t, numberType) : t);
|
|
61928
61933
|
}
|
|
61929
|
-
return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes);
|
|
61934
|
+
return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes, noReductions ? 0 /* None */ : 1 /* Literal */);
|
|
61930
61935
|
}
|
|
61931
61936
|
return void 0;
|
|
61932
61937
|
}
|
|
@@ -66513,9 +66518,18 @@ function createTypeChecker(host) {
|
|
|
66513
66518
|
if (prop) {
|
|
66514
66519
|
return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
|
|
66515
66520
|
}
|
|
66516
|
-
if (isTupleType(t)) {
|
|
66517
|
-
const restType =
|
|
66518
|
-
|
|
66521
|
+
if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
|
|
66522
|
+
const restType = getElementTypeOfSliceOfTupleType(
|
|
66523
|
+
t,
|
|
66524
|
+
t.target.fixedLength,
|
|
66525
|
+
/*endSkipCount*/
|
|
66526
|
+
0,
|
|
66527
|
+
/*writing*/
|
|
66528
|
+
false,
|
|
66529
|
+
/*noReductions*/
|
|
66530
|
+
true
|
|
66531
|
+
);
|
|
66532
|
+
if (restType) {
|
|
66519
66533
|
return restType;
|
|
66520
66534
|
}
|
|
66521
66535
|
}
|
|
@@ -66562,9 +66576,18 @@ function createTypeChecker(host) {
|
|
|
66562
66576
|
return void 0;
|
|
66563
66577
|
}
|
|
66564
66578
|
function getContextualTypeForElementExpression(arrayContextualType, index) {
|
|
66565
|
-
return arrayContextualType && (getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
|
|
66579
|
+
return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
|
|
66566
66580
|
arrayContextualType,
|
|
66567
|
-
(t) =>
|
|
66581
|
+
(t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
|
|
66582
|
+
t,
|
|
66583
|
+
0,
|
|
66584
|
+
/*endSkipCount*/
|
|
66585
|
+
0,
|
|
66586
|
+
/*writing*/
|
|
66587
|
+
false,
|
|
66588
|
+
/*noReductions*/
|
|
66589
|
+
true
|
|
66590
|
+
) : getIteratedTypeOrElementType(
|
|
66568
66591
|
1 /* Element */,
|
|
66569
66592
|
t,
|
|
66570
66593
|
undefinedType,
|
|
@@ -66717,6 +66740,7 @@ function createTypeChecker(host) {
|
|
|
66717
66740
|
return type;
|
|
66718
66741
|
}
|
|
66719
66742
|
function getContextualType(node, contextFlags) {
|
|
66743
|
+
var _a2, _b;
|
|
66720
66744
|
if (node.flags & 33554432 /* InWithStatement */) {
|
|
66721
66745
|
return void 0;
|
|
66722
66746
|
}
|
|
@@ -66761,7 +66785,9 @@ function createTypeChecker(host) {
|
|
|
66761
66785
|
case 206 /* ArrayLiteralExpression */: {
|
|
66762
66786
|
const arrayLiteral = parent;
|
|
66763
66787
|
const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
|
|
66764
|
-
|
|
66788
|
+
const spreadIndex = (_b = (_a2 = getNodeLinks(arrayLiteral)).firstSpreadIndex) != null ? _b : _a2.firstSpreadIndex = findIndex(arrayLiteral.elements, isSpreadElement);
|
|
66789
|
+
const elementIndex = indexOfNode(arrayLiteral.elements, node);
|
|
66790
|
+
return getContextualTypeForElementExpression(type, spreadIndex < 0 || elementIndex < spreadIndex ? elementIndex : -1);
|
|
66765
66791
|
}
|
|
66766
66792
|
case 224 /* ConditionalExpression */:
|
|
66767
66793
|
return getContextualTypeForConditionalOperand(node, contextFlags);
|
package/lib/tsserver.js
CHANGED
|
@@ -61020,6 +61020,11 @@ function createTypeChecker(host) {
|
|
|
61020
61020
|
}
|
|
61021
61021
|
function createTemplateLiteralType(texts, types) {
|
|
61022
61022
|
const type = createType(134217728 /* TemplateLiteral */);
|
|
61023
|
+
type.objectFlags = getPropagatingFlagsOfTypes(
|
|
61024
|
+
types,
|
|
61025
|
+
/*excludeKinds*/
|
|
61026
|
+
98304 /* Nullable */
|
|
61027
|
+
);
|
|
61023
61028
|
type.texts = texts;
|
|
61024
61029
|
type.types = types;
|
|
61025
61030
|
return type;
|
|
@@ -61334,7 +61339,7 @@ function createTypeChecker(host) {
|
|
|
61334
61339
|
return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */);
|
|
61335
61340
|
}
|
|
61336
61341
|
function getGenericObjectFlags(type) {
|
|
61337
|
-
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
61342
|
+
if (type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */)) {
|
|
61338
61343
|
if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) {
|
|
61339
61344
|
type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0);
|
|
61340
61345
|
}
|
|
@@ -61346,7 +61351,7 @@ function createTypeChecker(host) {
|
|
|
61346
61351
|
}
|
|
61347
61352
|
return type.objectFlags & 12582912 /* IsGenericType */;
|
|
61348
61353
|
}
|
|
61349
|
-
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ |
|
|
61354
|
+
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
|
|
61350
61355
|
}
|
|
61351
61356
|
function getSimplifiedType(type, writing) {
|
|
61352
61357
|
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
@@ -66524,7 +66529,7 @@ function createTypeChecker(host) {
|
|
|
66524
66529
|
const restType = getRestTypeOfTupleType(type);
|
|
66525
66530
|
return restType && createArrayType(restType);
|
|
66526
66531
|
}
|
|
66527
|
-
function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false) {
|
|
66532
|
+
function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false, noReductions = false) {
|
|
66528
66533
|
const length2 = getTypeReferenceArity(type) - endSkipCount;
|
|
66529
66534
|
if (index < length2) {
|
|
66530
66535
|
const typeArguments = getTypeArguments(type);
|
|
@@ -66533,7 +66538,7 @@ function createTypeChecker(host) {
|
|
|
66533
66538
|
const t = typeArguments[i];
|
|
66534
66539
|
elementTypes.push(type.target.elementFlags[i] & 8 /* Variadic */ ? getIndexedAccessType(t, numberType) : t);
|
|
66535
66540
|
}
|
|
66536
|
-
return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes);
|
|
66541
|
+
return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes, noReductions ? 0 /* None */ : 1 /* Literal */);
|
|
66537
66542
|
}
|
|
66538
66543
|
return void 0;
|
|
66539
66544
|
}
|
|
@@ -71120,9 +71125,18 @@ function createTypeChecker(host) {
|
|
|
71120
71125
|
if (prop) {
|
|
71121
71126
|
return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
|
|
71122
71127
|
}
|
|
71123
|
-
if (isTupleType(t)) {
|
|
71124
|
-
const restType =
|
|
71125
|
-
|
|
71128
|
+
if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
|
|
71129
|
+
const restType = getElementTypeOfSliceOfTupleType(
|
|
71130
|
+
t,
|
|
71131
|
+
t.target.fixedLength,
|
|
71132
|
+
/*endSkipCount*/
|
|
71133
|
+
0,
|
|
71134
|
+
/*writing*/
|
|
71135
|
+
false,
|
|
71136
|
+
/*noReductions*/
|
|
71137
|
+
true
|
|
71138
|
+
);
|
|
71139
|
+
if (restType) {
|
|
71126
71140
|
return restType;
|
|
71127
71141
|
}
|
|
71128
71142
|
}
|
|
@@ -71169,9 +71183,18 @@ function createTypeChecker(host) {
|
|
|
71169
71183
|
return void 0;
|
|
71170
71184
|
}
|
|
71171
71185
|
function getContextualTypeForElementExpression(arrayContextualType, index) {
|
|
71172
|
-
return arrayContextualType && (getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
|
|
71186
|
+
return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
|
|
71173
71187
|
arrayContextualType,
|
|
71174
|
-
(t) =>
|
|
71188
|
+
(t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
|
|
71189
|
+
t,
|
|
71190
|
+
0,
|
|
71191
|
+
/*endSkipCount*/
|
|
71192
|
+
0,
|
|
71193
|
+
/*writing*/
|
|
71194
|
+
false,
|
|
71195
|
+
/*noReductions*/
|
|
71196
|
+
true
|
|
71197
|
+
) : getIteratedTypeOrElementType(
|
|
71175
71198
|
1 /* Element */,
|
|
71176
71199
|
t,
|
|
71177
71200
|
undefinedType,
|
|
@@ -71324,6 +71347,7 @@ function createTypeChecker(host) {
|
|
|
71324
71347
|
return type;
|
|
71325
71348
|
}
|
|
71326
71349
|
function getContextualType2(node, contextFlags) {
|
|
71350
|
+
var _a2, _b;
|
|
71327
71351
|
if (node.flags & 33554432 /* InWithStatement */) {
|
|
71328
71352
|
return void 0;
|
|
71329
71353
|
}
|
|
@@ -71368,7 +71392,9 @@ function createTypeChecker(host) {
|
|
|
71368
71392
|
case 206 /* ArrayLiteralExpression */: {
|
|
71369
71393
|
const arrayLiteral = parent2;
|
|
71370
71394
|
const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
|
|
71371
|
-
|
|
71395
|
+
const spreadIndex = (_b = (_a2 = getNodeLinks(arrayLiteral)).firstSpreadIndex) != null ? _b : _a2.firstSpreadIndex = findIndex(arrayLiteral.elements, isSpreadElement);
|
|
71396
|
+
const elementIndex = indexOfNode(arrayLiteral.elements, node);
|
|
71397
|
+
return getContextualTypeForElementExpression(type, spreadIndex < 0 || elementIndex < spreadIndex ? elementIndex : -1);
|
|
71372
71398
|
}
|
|
71373
71399
|
case 224 /* ConditionalExpression */:
|
|
71374
71400
|
return getContextualTypeForConditionalOperand(node, contextFlags);
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -58828,6 +58828,11 @@ ${lanes.join("\n")}
|
|
|
58828
58828
|
}
|
|
58829
58829
|
function createTemplateLiteralType(texts, types) {
|
|
58830
58830
|
const type = createType(134217728 /* TemplateLiteral */);
|
|
58831
|
+
type.objectFlags = getPropagatingFlagsOfTypes(
|
|
58832
|
+
types,
|
|
58833
|
+
/*excludeKinds*/
|
|
58834
|
+
98304 /* Nullable */
|
|
58835
|
+
);
|
|
58831
58836
|
type.texts = texts;
|
|
58832
58837
|
type.types = types;
|
|
58833
58838
|
return type;
|
|
@@ -59142,7 +59147,7 @@ ${lanes.join("\n")}
|
|
|
59142
59147
|
return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */);
|
|
59143
59148
|
}
|
|
59144
59149
|
function getGenericObjectFlags(type) {
|
|
59145
|
-
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
59150
|
+
if (type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */)) {
|
|
59146
59151
|
if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) {
|
|
59147
59152
|
type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0);
|
|
59148
59153
|
}
|
|
@@ -59154,7 +59159,7 @@ ${lanes.join("\n")}
|
|
|
59154
59159
|
}
|
|
59155
59160
|
return type.objectFlags & 12582912 /* IsGenericType */;
|
|
59156
59161
|
}
|
|
59157
|
-
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ |
|
|
59162
|
+
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
|
|
59158
59163
|
}
|
|
59159
59164
|
function getSimplifiedType(type, writing) {
|
|
59160
59165
|
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
@@ -64332,7 +64337,7 @@ ${lanes.join("\n")}
|
|
|
64332
64337
|
const restType = getRestTypeOfTupleType(type);
|
|
64333
64338
|
return restType && createArrayType(restType);
|
|
64334
64339
|
}
|
|
64335
|
-
function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false) {
|
|
64340
|
+
function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false, noReductions = false) {
|
|
64336
64341
|
const length2 = getTypeReferenceArity(type) - endSkipCount;
|
|
64337
64342
|
if (index < length2) {
|
|
64338
64343
|
const typeArguments = getTypeArguments(type);
|
|
@@ -64341,7 +64346,7 @@ ${lanes.join("\n")}
|
|
|
64341
64346
|
const t = typeArguments[i];
|
|
64342
64347
|
elementTypes.push(type.target.elementFlags[i] & 8 /* Variadic */ ? getIndexedAccessType(t, numberType) : t);
|
|
64343
64348
|
}
|
|
64344
|
-
return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes);
|
|
64349
|
+
return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes, noReductions ? 0 /* None */ : 1 /* Literal */);
|
|
64345
64350
|
}
|
|
64346
64351
|
return void 0;
|
|
64347
64352
|
}
|
|
@@ -68928,9 +68933,18 @@ ${lanes.join("\n")}
|
|
|
68928
68933
|
if (prop) {
|
|
68929
68934
|
return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
|
|
68930
68935
|
}
|
|
68931
|
-
if (isTupleType(t)) {
|
|
68932
|
-
const restType =
|
|
68933
|
-
|
|
68936
|
+
if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
|
|
68937
|
+
const restType = getElementTypeOfSliceOfTupleType(
|
|
68938
|
+
t,
|
|
68939
|
+
t.target.fixedLength,
|
|
68940
|
+
/*endSkipCount*/
|
|
68941
|
+
0,
|
|
68942
|
+
/*writing*/
|
|
68943
|
+
false,
|
|
68944
|
+
/*noReductions*/
|
|
68945
|
+
true
|
|
68946
|
+
);
|
|
68947
|
+
if (restType) {
|
|
68934
68948
|
return restType;
|
|
68935
68949
|
}
|
|
68936
68950
|
}
|
|
@@ -68977,9 +68991,18 @@ ${lanes.join("\n")}
|
|
|
68977
68991
|
return void 0;
|
|
68978
68992
|
}
|
|
68979
68993
|
function getContextualTypeForElementExpression(arrayContextualType, index) {
|
|
68980
|
-
return arrayContextualType && (getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
|
|
68994
|
+
return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
|
|
68981
68995
|
arrayContextualType,
|
|
68982
|
-
(t) =>
|
|
68996
|
+
(t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
|
|
68997
|
+
t,
|
|
68998
|
+
0,
|
|
68999
|
+
/*endSkipCount*/
|
|
69000
|
+
0,
|
|
69001
|
+
/*writing*/
|
|
69002
|
+
false,
|
|
69003
|
+
/*noReductions*/
|
|
69004
|
+
true
|
|
69005
|
+
) : getIteratedTypeOrElementType(
|
|
68983
69006
|
1 /* Element */,
|
|
68984
69007
|
t,
|
|
68985
69008
|
undefinedType,
|
|
@@ -69132,6 +69155,7 @@ ${lanes.join("\n")}
|
|
|
69132
69155
|
return type;
|
|
69133
69156
|
}
|
|
69134
69157
|
function getContextualType2(node, contextFlags) {
|
|
69158
|
+
var _a2, _b;
|
|
69135
69159
|
if (node.flags & 33554432 /* InWithStatement */) {
|
|
69136
69160
|
return void 0;
|
|
69137
69161
|
}
|
|
@@ -69176,7 +69200,9 @@ ${lanes.join("\n")}
|
|
|
69176
69200
|
case 206 /* ArrayLiteralExpression */: {
|
|
69177
69201
|
const arrayLiteral = parent2;
|
|
69178
69202
|
const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
|
|
69179
|
-
|
|
69203
|
+
const spreadIndex = (_b = (_a2 = getNodeLinks(arrayLiteral)).firstSpreadIndex) != null ? _b : _a2.firstSpreadIndex = findIndex(arrayLiteral.elements, isSpreadElement);
|
|
69204
|
+
const elementIndex = indexOfNode(arrayLiteral.elements, node);
|
|
69205
|
+
return getContextualTypeForElementExpression(type, spreadIndex < 0 || elementIndex < spreadIndex ? elementIndex : -1);
|
|
69180
69206
|
}
|
|
69181
69207
|
case 224 /* ConditionalExpression */:
|
|
69182
69208
|
return getContextualTypeForConditionalOperand(node, contextFlags);
|
package/lib/typescript.js
CHANGED
|
@@ -58828,6 +58828,11 @@ ${lanes.join("\n")}
|
|
|
58828
58828
|
}
|
|
58829
58829
|
function createTemplateLiteralType(texts, types) {
|
|
58830
58830
|
const type = createType(134217728 /* TemplateLiteral */);
|
|
58831
|
+
type.objectFlags = getPropagatingFlagsOfTypes(
|
|
58832
|
+
types,
|
|
58833
|
+
/*excludeKinds*/
|
|
58834
|
+
98304 /* Nullable */
|
|
58835
|
+
);
|
|
58831
58836
|
type.texts = texts;
|
|
58832
58837
|
type.types = types;
|
|
58833
58838
|
return type;
|
|
@@ -59142,7 +59147,7 @@ ${lanes.join("\n")}
|
|
|
59142
59147
|
return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */);
|
|
59143
59148
|
}
|
|
59144
59149
|
function getGenericObjectFlags(type) {
|
|
59145
|
-
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
59150
|
+
if (type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */)) {
|
|
59146
59151
|
if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) {
|
|
59147
59152
|
type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0);
|
|
59148
59153
|
}
|
|
@@ -59154,7 +59159,7 @@ ${lanes.join("\n")}
|
|
|
59154
59159
|
}
|
|
59155
59160
|
return type.objectFlags & 12582912 /* IsGenericType */;
|
|
59156
59161
|
}
|
|
59157
|
-
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ |
|
|
59162
|
+
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
|
|
59158
59163
|
}
|
|
59159
59164
|
function getSimplifiedType(type, writing) {
|
|
59160
59165
|
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
@@ -64332,7 +64337,7 @@ ${lanes.join("\n")}
|
|
|
64332
64337
|
const restType = getRestTypeOfTupleType(type);
|
|
64333
64338
|
return restType && createArrayType(restType);
|
|
64334
64339
|
}
|
|
64335
|
-
function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false) {
|
|
64340
|
+
function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false, noReductions = false) {
|
|
64336
64341
|
const length2 = getTypeReferenceArity(type) - endSkipCount;
|
|
64337
64342
|
if (index < length2) {
|
|
64338
64343
|
const typeArguments = getTypeArguments(type);
|
|
@@ -64341,7 +64346,7 @@ ${lanes.join("\n")}
|
|
|
64341
64346
|
const t = typeArguments[i];
|
|
64342
64347
|
elementTypes.push(type.target.elementFlags[i] & 8 /* Variadic */ ? getIndexedAccessType(t, numberType) : t);
|
|
64343
64348
|
}
|
|
64344
|
-
return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes);
|
|
64349
|
+
return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes, noReductions ? 0 /* None */ : 1 /* Literal */);
|
|
64345
64350
|
}
|
|
64346
64351
|
return void 0;
|
|
64347
64352
|
}
|
|
@@ -68928,9 +68933,18 @@ ${lanes.join("\n")}
|
|
|
68928
68933
|
if (prop) {
|
|
68929
68934
|
return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
|
|
68930
68935
|
}
|
|
68931
|
-
if (isTupleType(t)) {
|
|
68932
|
-
const restType =
|
|
68933
|
-
|
|
68936
|
+
if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
|
|
68937
|
+
const restType = getElementTypeOfSliceOfTupleType(
|
|
68938
|
+
t,
|
|
68939
|
+
t.target.fixedLength,
|
|
68940
|
+
/*endSkipCount*/
|
|
68941
|
+
0,
|
|
68942
|
+
/*writing*/
|
|
68943
|
+
false,
|
|
68944
|
+
/*noReductions*/
|
|
68945
|
+
true
|
|
68946
|
+
);
|
|
68947
|
+
if (restType) {
|
|
68934
68948
|
return restType;
|
|
68935
68949
|
}
|
|
68936
68950
|
}
|
|
@@ -68977,9 +68991,18 @@ ${lanes.join("\n")}
|
|
|
68977
68991
|
return void 0;
|
|
68978
68992
|
}
|
|
68979
68993
|
function getContextualTypeForElementExpression(arrayContextualType, index) {
|
|
68980
|
-
return arrayContextualType && (getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
|
|
68994
|
+
return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
|
|
68981
68995
|
arrayContextualType,
|
|
68982
|
-
(t) =>
|
|
68996
|
+
(t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
|
|
68997
|
+
t,
|
|
68998
|
+
0,
|
|
68999
|
+
/*endSkipCount*/
|
|
69000
|
+
0,
|
|
69001
|
+
/*writing*/
|
|
69002
|
+
false,
|
|
69003
|
+
/*noReductions*/
|
|
69004
|
+
true
|
|
69005
|
+
) : getIteratedTypeOrElementType(
|
|
68983
69006
|
1 /* Element */,
|
|
68984
69007
|
t,
|
|
68985
69008
|
undefinedType,
|
|
@@ -69132,6 +69155,7 @@ ${lanes.join("\n")}
|
|
|
69132
69155
|
return type;
|
|
69133
69156
|
}
|
|
69134
69157
|
function getContextualType2(node, contextFlags) {
|
|
69158
|
+
var _a2, _b;
|
|
69135
69159
|
if (node.flags & 33554432 /* InWithStatement */) {
|
|
69136
69160
|
return void 0;
|
|
69137
69161
|
}
|
|
@@ -69176,7 +69200,9 @@ ${lanes.join("\n")}
|
|
|
69176
69200
|
case 206 /* ArrayLiteralExpression */: {
|
|
69177
69201
|
const arrayLiteral = parent2;
|
|
69178
69202
|
const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
|
|
69179
|
-
|
|
69203
|
+
const spreadIndex = (_b = (_a2 = getNodeLinks(arrayLiteral)).firstSpreadIndex) != null ? _b : _a2.firstSpreadIndex = findIndex(arrayLiteral.elements, isSpreadElement);
|
|
69204
|
+
const elementIndex = indexOfNode(arrayLiteral.elements, node);
|
|
69205
|
+
return getContextualTypeForElementExpression(type, spreadIndex < 0 || elementIndex < spreadIndex ? elementIndex : -1);
|
|
69180
69206
|
}
|
|
69181
69207
|
case 224 /* ConditionalExpression */:
|
|
69182
69208
|
return getContextualTypeForConditionalOperand(node, contextFlags);
|
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.0.0-pr-52836-
|
|
5
|
+
"version": "5.0.0-pr-52836-22",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|