@typescript-deploys/pr-build 4.7.0-pr-47461-10 → 4.7.0-pr-48861-7
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 +48 -28
- package/lib/tsserver.js +53 -29
- package/lib/tsserverlibrary.js +53 -29
- package/lib/typescript.js +53 -29
- package/lib/typescriptServices.js +53 -29
- package/lib/typingsInstaller.js +53 -29
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.7";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220427";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -13561,19 +13561,11 @@ var ts;
|
|
|
13561
13561
|
return !!name && isDynamicName(name);
|
|
13562
13562
|
}
|
|
13563
13563
|
ts.hasDynamicName = hasDynamicName;
|
|
13564
|
-
function getComputedPropertyNameExpression(name) {
|
|
13565
|
-
return ts.isElementAccessExpression(name.expression)
|
|
13566
|
-
? skipParentheses(name.expression.argumentExpression)
|
|
13567
|
-
: name.expression;
|
|
13568
|
-
}
|
|
13569
|
-
ts.getComputedPropertyNameExpression = getComputedPropertyNameExpression;
|
|
13570
13564
|
function isDynamicName(name) {
|
|
13571
13565
|
if (!(name.kind === 162 || name.kind === 207)) {
|
|
13572
13566
|
return false;
|
|
13573
13567
|
}
|
|
13574
|
-
var expr = ts.isElementAccessExpression(name)
|
|
13575
|
-
? skipParentheses(name.argumentExpression)
|
|
13576
|
-
: getComputedPropertyNameExpression(name);
|
|
13568
|
+
var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression;
|
|
13577
13569
|
return !isStringOrNumericLiteralLike(expr) &&
|
|
13578
13570
|
!isSignedNumericLiteral(expr);
|
|
13579
13571
|
}
|
|
@@ -13587,7 +13579,7 @@ var ts;
|
|
|
13587
13579
|
case 8:
|
|
13588
13580
|
return ts.escapeLeadingUnderscores(name.text);
|
|
13589
13581
|
case 162:
|
|
13590
|
-
var nameExpression =
|
|
13582
|
+
var nameExpression = name.expression;
|
|
13591
13583
|
if (isStringOrNumericLiteralLike(nameExpression)) {
|
|
13592
13584
|
return ts.escapeLeadingUnderscores(nameExpression.text);
|
|
13593
13585
|
}
|
|
@@ -36345,7 +36337,7 @@ var ts;
|
|
|
36345
36337
|
return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + moduleName + "\"");
|
|
36346
36338
|
}
|
|
36347
36339
|
if (name.kind === 162) {
|
|
36348
|
-
var nameExpression =
|
|
36340
|
+
var nameExpression = name.expression;
|
|
36349
36341
|
if (ts.isStringOrNumericLiteralLike(nameExpression)) {
|
|
36350
36342
|
return ts.escapeLeadingUnderscores(nameExpression.text);
|
|
36351
36343
|
}
|
|
@@ -39576,6 +39568,7 @@ var ts;
|
|
|
39576
39568
|
var keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
|
|
39577
39569
|
var numberOrBigIntType = getUnionType([numberType, bigintType]);
|
|
39578
39570
|
var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
|
|
39571
|
+
var numericStringType = getTemplateLiteralType(["", ""], [numberType]);
|
|
39579
39572
|
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 ? getRestrictiveTypeParameter(t) : t; });
|
|
39580
39573
|
var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 ? wildcardType : t; });
|
|
39581
39574
|
var uniqueLiteralType = createIntrinsicType(131072, "never");
|
|
@@ -42170,7 +42163,7 @@ var ts;
|
|
|
42170
42163
|
}
|
|
42171
42164
|
}
|
|
42172
42165
|
function getExportSymbolOfValueSymbolIfExported(symbol) {
|
|
42173
|
-
return getMergedSymbol(symbol && (symbol.flags & 1048576) !== 0
|
|
42166
|
+
return getMergedSymbol(symbol && (symbol.flags & 1048576) !== 0 && symbol.exportSymbol || symbol);
|
|
42174
42167
|
}
|
|
42175
42168
|
function symbolIsValue(symbol) {
|
|
42176
42169
|
return !!(symbol.flags & 111551 || symbol.flags & 2097152 && resolveAlias(symbol).flags & 111551 && !getTypeOnlyAliasDeclaration(symbol));
|
|
@@ -48565,7 +48558,7 @@ var ts;
|
|
|
48565
48558
|
var typeVariable = getHomomorphicTypeVariable(type);
|
|
48566
48559
|
if (typeVariable && !type.declaration.nameType) {
|
|
48567
48560
|
var constraint = getConstraintOfTypeParameter(typeVariable);
|
|
48568
|
-
if (constraint && (
|
|
48561
|
+
if (constraint && isArrayOrTupleType(constraint)) {
|
|
48569
48562
|
return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
|
|
48570
48563
|
}
|
|
48571
48564
|
}
|
|
@@ -48874,7 +48867,7 @@ var ts;
|
|
|
48874
48867
|
function isApplicableIndexType(source, target) {
|
|
48875
48868
|
return isTypeAssignableTo(source, target) ||
|
|
48876
48869
|
target === stringType && isTypeAssignableTo(source, numberType) ||
|
|
48877
|
-
target === numberType && !!(source.flags & 128) && ts.isNumericLiteralName(source.value);
|
|
48870
|
+
target === numberType && (source === numericStringType || !!(source.flags & 128) && ts.isNumericLiteralName(source.value));
|
|
48878
48871
|
}
|
|
48879
48872
|
function getIndexInfosOfStructuredType(type) {
|
|
48880
48873
|
if (type.flags & 3670016) {
|
|
@@ -49780,6 +49773,18 @@ var ts;
|
|
|
49780
49773
|
constraints = ts.append(constraints, constraint);
|
|
49781
49774
|
}
|
|
49782
49775
|
}
|
|
49776
|
+
else if (type.flags & 262144 && parent.kind === 195 && node === parent.type) {
|
|
49777
|
+
var mappedType = getTypeFromTypeNode(parent);
|
|
49778
|
+
if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
|
|
49779
|
+
var typeParameter = getHomomorphicTypeVariable(mappedType);
|
|
49780
|
+
if (typeParameter) {
|
|
49781
|
+
var constraint = getConstraintOfTypeParameter(typeParameter);
|
|
49782
|
+
if (constraint && everyType(constraint, isArrayOrTupleType)) {
|
|
49783
|
+
constraints = ts.append(constraints, getUnionType([numberType, numericStringType]));
|
|
49784
|
+
}
|
|
49785
|
+
}
|
|
49786
|
+
}
|
|
49787
|
+
}
|
|
49783
49788
|
node = parent;
|
|
49784
49789
|
}
|
|
49785
49790
|
return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type;
|
|
@@ -50666,7 +50671,7 @@ var ts;
|
|
|
50666
50671
|
while (i > 0) {
|
|
50667
50672
|
i--;
|
|
50668
50673
|
var t = types[i];
|
|
50669
|
-
var remove = t.flags & 4 && includes & 128 ||
|
|
50674
|
+
var remove = t.flags & 4 && includes & (128 | 134217728 | 268435456) ||
|
|
50670
50675
|
t.flags & 8 && includes & 256 ||
|
|
50671
50676
|
t.flags & 64 && includes & 2048 ||
|
|
50672
50677
|
t.flags & 4096 && includes & 8192;
|
|
@@ -50789,7 +50794,7 @@ var ts;
|
|
|
50789
50794
|
if (!strictNullChecks && includes & 98304) {
|
|
50790
50795
|
return includes & 32768 ? undefinedType : nullType;
|
|
50791
50796
|
}
|
|
50792
|
-
if (includes & 4 && includes & 128 ||
|
|
50797
|
+
if (includes & 4 && includes & (128 | 134217728 | 268435456) ||
|
|
50793
50798
|
includes & 8 && includes & 256 ||
|
|
50794
50799
|
includes & 64 && includes & 2048 ||
|
|
50795
50800
|
includes & 4096 && includes & 8192) {
|
|
@@ -52457,7 +52462,7 @@ var ts;
|
|
|
52457
52462
|
if (!type.declaration.nameType) {
|
|
52458
52463
|
var constraint = void 0;
|
|
52459
52464
|
if (isArrayType(t) || t.flags & 1 && findResolutionCycleStartIndex(typeVariable, 4) < 0 &&
|
|
52460
|
-
(constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint,
|
|
52465
|
+
(constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
52461
52466
|
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
52462
52467
|
}
|
|
52463
52468
|
if (isGenericTupleType(t)) {
|
|
@@ -53752,7 +53757,7 @@ var ts;
|
|
|
53752
53757
|
}
|
|
53753
53758
|
return false;
|
|
53754
53759
|
}
|
|
53755
|
-
return
|
|
53760
|
+
return isArrayOrTupleType(target);
|
|
53756
53761
|
}
|
|
53757
53762
|
if (isReadonlyArrayType(source) && isMutableArrayOrTuple(target)) {
|
|
53758
53763
|
if (reportErrors) {
|
|
@@ -53848,7 +53853,7 @@ var ts;
|
|
|
53848
53853
|
unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) :
|
|
53849
53854
|
recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags);
|
|
53850
53855
|
if (result_7 && !inPropertyCheck && (target.flags & 2097152 && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
|
|
53851
|
-
isNonGenericObjectType(target) && !
|
|
53856
|
+
isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 && getApparentType(source).flags & 3670016 && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144); }))) {
|
|
53852
53857
|
inPropertyCheck = true;
|
|
53853
53858
|
result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4, recursionFlags);
|
|
53854
53859
|
inPropertyCheck = false;
|
|
@@ -54383,6 +54388,18 @@ var ts;
|
|
|
54383
54388
|
}
|
|
54384
54389
|
}
|
|
54385
54390
|
}
|
|
54391
|
+
if (relation === comparableRelation && sourceFlags & 262144) {
|
|
54392
|
+
var constraint = getConstraintOfTypeParameter(source);
|
|
54393
|
+
if (constraint && hasNonCircularBaseConstraint(source)) {
|
|
54394
|
+
while (constraint && constraint.flags & 262144) {
|
|
54395
|
+
if (result = isRelatedTo(constraint, target, 1, false)) {
|
|
54396
|
+
return result;
|
|
54397
|
+
}
|
|
54398
|
+
constraint = getConstraintOfTypeParameter(constraint);
|
|
54399
|
+
}
|
|
54400
|
+
}
|
|
54401
|
+
return 0;
|
|
54402
|
+
}
|
|
54386
54403
|
}
|
|
54387
54404
|
else if (targetFlags & 4194304) {
|
|
54388
54405
|
var targetType_1 = target.type;
|
|
@@ -54533,18 +54550,18 @@ var ts;
|
|
|
54533
54550
|
}
|
|
54534
54551
|
if (sourceFlags & 8650752) {
|
|
54535
54552
|
if (!(sourceFlags & 8388608 && targetFlags & 8388608)) {
|
|
54536
|
-
var constraint = getConstraintOfType(source);
|
|
54553
|
+
var constraint = getConstraintOfType(source) || unknownType;
|
|
54537
54554
|
if (!strictNullChecks && (!constraint || (sourceFlags & 262144 && constraint.flags & 1))) {
|
|
54538
54555
|
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864), 3)) {
|
|
54539
54556
|
resetErrorInfo(saveErrorInfo);
|
|
54540
54557
|
return result;
|
|
54541
54558
|
}
|
|
54542
54559
|
}
|
|
54543
|
-
else if (
|
|
54560
|
+
else if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
|
|
54544
54561
|
resetErrorInfo(saveErrorInfo);
|
|
54545
54562
|
return result;
|
|
54546
54563
|
}
|
|
54547
|
-
else if (
|
|
54564
|
+
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1, reportErrors && !(targetFlags & sourceFlags & 262144), undefined, intersectionState)) {
|
|
54548
54565
|
resetErrorInfo(saveErrorInfo);
|
|
54549
54566
|
return result;
|
|
54550
54567
|
}
|
|
@@ -54667,7 +54684,7 @@ var ts;
|
|
|
54667
54684
|
return varianceResult;
|
|
54668
54685
|
}
|
|
54669
54686
|
}
|
|
54670
|
-
else if (isReadonlyArrayType(target) ?
|
|
54687
|
+
else if (isReadonlyArrayType(target) ? isArrayOrTupleType(source) : isArrayType(target) && isTupleType(source) && !source.target.readonly) {
|
|
54671
54688
|
if (relation !== identityRelation) {
|
|
54672
54689
|
return isRelatedTo(getIndexTypeOfType(source, numberType) || anyType, getIndexTypeOfType(target, numberType) || anyType, 3, reportErrors);
|
|
54673
54690
|
}
|
|
@@ -54961,7 +54978,7 @@ var ts;
|
|
|
54961
54978
|
}
|
|
54962
54979
|
var result = -1;
|
|
54963
54980
|
if (isTupleType(target)) {
|
|
54964
|
-
if (
|
|
54981
|
+
if (isArrayOrTupleType(source)) {
|
|
54965
54982
|
if (!target.target.readonly && (isReadonlyArrayType(source) || isTupleType(source) && source.target.readonly)) {
|
|
54966
54983
|
return 0;
|
|
54967
54984
|
}
|
|
@@ -55808,6 +55825,9 @@ var ts;
|
|
|
55808
55825
|
function isReadonlyArrayType(type) {
|
|
55809
55826
|
return !!(ts.getObjectFlags(type) & 4) && type.target === globalReadonlyArrayType;
|
|
55810
55827
|
}
|
|
55828
|
+
function isArrayOrTupleType(type) {
|
|
55829
|
+
return isArrayType(type) || isTupleType(type);
|
|
55830
|
+
}
|
|
55811
55831
|
function isMutableArrayOrTuple(type) {
|
|
55812
55832
|
return isArrayType(type) && !isReadonlyArrayType(type) || isTupleType(type) && !type.target.readonly;
|
|
55813
55833
|
}
|
|
@@ -56205,7 +56225,7 @@ var ts;
|
|
|
56205
56225
|
else if (type.flags & 2097152) {
|
|
56206
56226
|
result = getIntersectionType(ts.sameMap(type.types, getWidenedType));
|
|
56207
56227
|
}
|
|
56208
|
-
else if (
|
|
56228
|
+
else if (isArrayOrTupleType(type)) {
|
|
56209
56229
|
result = createTypeReference(type.target, ts.sameMap(getTypeArguments(type), getWidenedType));
|
|
56210
56230
|
}
|
|
56211
56231
|
if (result && context === undefined) {
|
|
@@ -56231,7 +56251,7 @@ var ts;
|
|
|
56231
56251
|
}
|
|
56232
56252
|
}
|
|
56233
56253
|
}
|
|
56234
|
-
if (
|
|
56254
|
+
if (isArrayOrTupleType(type)) {
|
|
56235
56255
|
for (var _b = 0, _c = getTypeArguments(type); _b < _c.length; _b++) {
|
|
56236
56256
|
var t = _c[_b];
|
|
56237
56257
|
if (reportWideningErrorsInType(t)) {
|
|
@@ -57133,7 +57153,7 @@ var ts;
|
|
|
57133
57153
|
}
|
|
57134
57154
|
}
|
|
57135
57155
|
if (!typesDefinitelyUnrelated(source, target)) {
|
|
57136
|
-
if (
|
|
57156
|
+
if (isArrayOrTupleType(source)) {
|
|
57137
57157
|
if (isTupleType(target)) {
|
|
57138
57158
|
var sourceArity = getTypeReferenceArity(source);
|
|
57139
57159
|
var targetArity = getTypeReferenceArity(target);
|
package/lib/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220427";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -17307,19 +17307,11 @@ var ts;
|
|
|
17307
17307
|
return !!name && isDynamicName(name);
|
|
17308
17308
|
}
|
|
17309
17309
|
ts.hasDynamicName = hasDynamicName;
|
|
17310
|
-
function getComputedPropertyNameExpression(name) {
|
|
17311
|
-
return ts.isElementAccessExpression(name.expression)
|
|
17312
|
-
? skipParentheses(name.expression.argumentExpression)
|
|
17313
|
-
: name.expression;
|
|
17314
|
-
}
|
|
17315
|
-
ts.getComputedPropertyNameExpression = getComputedPropertyNameExpression;
|
|
17316
17310
|
function isDynamicName(name) {
|
|
17317
17311
|
if (!(name.kind === 162 /* ComputedPropertyName */ || name.kind === 207 /* ElementAccessExpression */)) {
|
|
17318
17312
|
return false;
|
|
17319
17313
|
}
|
|
17320
|
-
var expr = ts.isElementAccessExpression(name)
|
|
17321
|
-
? skipParentheses(name.argumentExpression)
|
|
17322
|
-
: getComputedPropertyNameExpression(name);
|
|
17314
|
+
var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression;
|
|
17323
17315
|
return !isStringOrNumericLiteralLike(expr) &&
|
|
17324
17316
|
!isSignedNumericLiteral(expr);
|
|
17325
17317
|
}
|
|
@@ -17333,7 +17325,7 @@ var ts;
|
|
|
17333
17325
|
case 8 /* NumericLiteral */:
|
|
17334
17326
|
return ts.escapeLeadingUnderscores(name.text);
|
|
17335
17327
|
case 162 /* ComputedPropertyName */:
|
|
17336
|
-
var nameExpression =
|
|
17328
|
+
var nameExpression = name.expression;
|
|
17337
17329
|
if (isStringOrNumericLiteralLike(nameExpression)) {
|
|
17338
17330
|
return ts.escapeLeadingUnderscores(nameExpression.text);
|
|
17339
17331
|
}
|
|
@@ -44455,7 +44447,7 @@ var ts;
|
|
|
44455
44447
|
return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + moduleName + "\"");
|
|
44456
44448
|
}
|
|
44457
44449
|
if (name.kind === 162 /* ComputedPropertyName */) {
|
|
44458
|
-
var nameExpression =
|
|
44450
|
+
var nameExpression = name.expression;
|
|
44459
44451
|
// treat computed property names where expression is string/numeric literal as just string/numeric literal
|
|
44460
44452
|
if (ts.isStringOrNumericLiteralLike(nameExpression)) {
|
|
44461
44453
|
return ts.escapeLeadingUnderscores(nameExpression.text);
|
|
@@ -48344,6 +48336,7 @@ var ts;
|
|
|
48344
48336
|
var keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
|
|
48345
48337
|
var numberOrBigIntType = getUnionType([numberType, bigintType]);
|
|
48346
48338
|
var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
|
|
48339
|
+
var numericStringType = getTemplateLiteralType(["", ""], [numberType]); // The `${number}` type
|
|
48347
48340
|
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; });
|
|
48348
48341
|
var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; });
|
|
48349
48342
|
var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never"); // `uniqueLiteralType` is a special `never` flagged by union reduction to behave as a literal
|
|
@@ -51325,7 +51318,7 @@ var ts;
|
|
|
51325
51318
|
}
|
|
51326
51319
|
}
|
|
51327
51320
|
function getExportSymbolOfValueSymbolIfExported(symbol) {
|
|
51328
|
-
return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0
|
|
51321
|
+
return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 && symbol.exportSymbol || symbol);
|
|
51329
51322
|
}
|
|
51330
51323
|
function symbolIsValue(symbol) {
|
|
51331
51324
|
return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 111551 /* Value */ && !getTypeOnlyAliasDeclaration(symbol));
|
|
@@ -58728,7 +58721,7 @@ var ts;
|
|
|
58728
58721
|
var typeVariable = getHomomorphicTypeVariable(type);
|
|
58729
58722
|
if (typeVariable && !type.declaration.nameType) {
|
|
58730
58723
|
var constraint = getConstraintOfTypeParameter(typeVariable);
|
|
58731
|
-
if (constraint && (
|
|
58724
|
+
if (constraint && isArrayOrTupleType(constraint)) {
|
|
58732
58725
|
return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
|
|
58733
58726
|
}
|
|
58734
58727
|
}
|
|
@@ -59090,10 +59083,10 @@ var ts;
|
|
|
59090
59083
|
}
|
|
59091
59084
|
function isApplicableIndexType(source, target) {
|
|
59092
59085
|
// A 'string' index signature applies to types assignable to 'string' or 'number', and a 'number' index
|
|
59093
|
-
// signature applies to types assignable to 'number' and numeric string literal types.
|
|
59086
|
+
// signature applies to types assignable to 'number', `${number}` and numeric string literal types.
|
|
59094
59087
|
return isTypeAssignableTo(source, target) ||
|
|
59095
59088
|
target === stringType && isTypeAssignableTo(source, numberType) ||
|
|
59096
|
-
target === numberType && !!(source.flags & 128 /* StringLiteral */) && ts.isNumericLiteralName(source.value);
|
|
59089
|
+
target === numberType && (source === numericStringType || !!(source.flags & 128 /* StringLiteral */) && ts.isNumericLiteralName(source.value));
|
|
59097
59090
|
}
|
|
59098
59091
|
function getIndexInfosOfStructuredType(type) {
|
|
59099
59092
|
if (type.flags & 3670016 /* StructuredType */) {
|
|
@@ -60109,6 +60102,20 @@ var ts;
|
|
|
60109
60102
|
constraints = ts.append(constraints, constraint);
|
|
60110
60103
|
}
|
|
60111
60104
|
}
|
|
60105
|
+
// Given a homomorphic mapped type { [K in keyof T]: XXX }, where T is constrained to an array or tuple type, in the
|
|
60106
|
+
// template type XXX, K has an added constraint of number | `${number}`.
|
|
60107
|
+
else if (type.flags & 262144 /* TypeParameter */ && parent.kind === 195 /* MappedType */ && node === parent.type) {
|
|
60108
|
+
var mappedType = getTypeFromTypeNode(parent);
|
|
60109
|
+
if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
|
|
60110
|
+
var typeParameter = getHomomorphicTypeVariable(mappedType);
|
|
60111
|
+
if (typeParameter) {
|
|
60112
|
+
var constraint = getConstraintOfTypeParameter(typeParameter);
|
|
60113
|
+
if (constraint && everyType(constraint, isArrayOrTupleType)) {
|
|
60114
|
+
constraints = ts.append(constraints, getUnionType([numberType, numericStringType]));
|
|
60115
|
+
}
|
|
60116
|
+
}
|
|
60117
|
+
}
|
|
60118
|
+
}
|
|
60112
60119
|
node = parent;
|
|
60113
60120
|
}
|
|
60114
60121
|
return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type;
|
|
@@ -61076,7 +61083,7 @@ var ts;
|
|
|
61076
61083
|
while (i > 0) {
|
|
61077
61084
|
i--;
|
|
61078
61085
|
var t = types[i];
|
|
61079
|
-
var remove = t.flags & 4 /* String */ && includes & 128 /* StringLiteral */ ||
|
|
61086
|
+
var remove = t.flags & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
|
|
61080
61087
|
t.flags & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
|
|
61081
61088
|
t.flags & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
|
|
61082
61089
|
t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */;
|
|
@@ -61235,7 +61242,7 @@ var ts;
|
|
|
61235
61242
|
if (!strictNullChecks && includes & 98304 /* Nullable */) {
|
|
61236
61243
|
return includes & 32768 /* Undefined */ ? undefinedType : nullType;
|
|
61237
61244
|
}
|
|
61238
|
-
if (includes & 4 /* String */ && includes & 128 /* StringLiteral */ ||
|
|
61245
|
+
if (includes & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
|
|
61239
61246
|
includes & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
|
|
61240
61247
|
includes & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
|
|
61241
61248
|
includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */) {
|
|
@@ -63119,7 +63126,7 @@ var ts;
|
|
|
63119
63126
|
if (!type.declaration.nameType) {
|
|
63120
63127
|
var constraint = void 0;
|
|
63121
63128
|
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 &&
|
|
63122
|
-
(constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint,
|
|
63129
|
+
(constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
63123
63130
|
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
63124
63131
|
}
|
|
63125
63132
|
if (isGenericTupleType(t)) {
|
|
@@ -64557,7 +64564,7 @@ var ts;
|
|
|
64557
64564
|
}
|
|
64558
64565
|
return false;
|
|
64559
64566
|
}
|
|
64560
|
-
return
|
|
64567
|
+
return isArrayOrTupleType(target);
|
|
64561
64568
|
}
|
|
64562
64569
|
if (isReadonlyArrayType(source) && isMutableArrayOrTuple(target)) {
|
|
64563
64570
|
if (reportErrors) {
|
|
@@ -64687,7 +64694,7 @@ var ts;
|
|
|
64687
64694
|
// We suppress recursive intersection property checks because they can generate lots of work when relating
|
|
64688
64695
|
// recursive intersections that are structurally similar but not exactly identical. See #37854.
|
|
64689
64696
|
if (result_7 && !inPropertyCheck && (target.flags & 2097152 /* Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
|
|
64690
|
-
isNonGenericObjectType(target) && !
|
|
64697
|
+
isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* Intersection */ && getApparentType(source).flags & 3670016 /* StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* NonInferrableType */); }))) {
|
|
64691
64698
|
inPropertyCheck = true;
|
|
64692
64699
|
result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* PropertyCheck */, recursionFlags);
|
|
64693
64700
|
inPropertyCheck = false;
|
|
@@ -65314,6 +65321,20 @@ var ts;
|
|
|
65314
65321
|
}
|
|
65315
65322
|
}
|
|
65316
65323
|
}
|
|
65324
|
+
if (relation === comparableRelation && sourceFlags & 262144 /* TypeParameter */) {
|
|
65325
|
+
// This is a carve-out in comparability to essentially forbid comparing a type parameter
|
|
65326
|
+
// with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!)
|
|
65327
|
+
var constraint = getConstraintOfTypeParameter(source);
|
|
65328
|
+
if (constraint && hasNonCircularBaseConstraint(source)) {
|
|
65329
|
+
while (constraint && constraint.flags & 262144 /* TypeParameter */) {
|
|
65330
|
+
if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false)) {
|
|
65331
|
+
return result;
|
|
65332
|
+
}
|
|
65333
|
+
constraint = getConstraintOfTypeParameter(constraint);
|
|
65334
|
+
}
|
|
65335
|
+
}
|
|
65336
|
+
return 0 /* False */;
|
|
65337
|
+
}
|
|
65317
65338
|
}
|
|
65318
65339
|
else if (targetFlags & 4194304 /* Index */) {
|
|
65319
65340
|
var targetType_1 = target.type;
|
|
@@ -65517,7 +65538,7 @@ var ts;
|
|
|
65517
65538
|
if (sourceFlags & 8650752 /* TypeVariable */) {
|
|
65518
65539
|
// IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
|
|
65519
65540
|
if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
|
|
65520
|
-
var constraint = getConstraintOfType(source);
|
|
65541
|
+
var constraint = getConstraintOfType(source) || unknownType;
|
|
65521
65542
|
if (!strictNullChecks && (!constraint || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */))) {
|
|
65522
65543
|
// A type variable with no constraint is not related to the non-primitive object type.
|
|
65523
65544
|
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
|
|
@@ -65526,12 +65547,12 @@ var ts;
|
|
|
65526
65547
|
}
|
|
65527
65548
|
}
|
|
65528
65549
|
// hi-speed no-this-instantiation check (less accurate, but avoids costly `this`-instantiation when the constraint will suffice), see #28231 for report on why this is needed
|
|
65529
|
-
else if (
|
|
65550
|
+
else if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
65530
65551
|
resetErrorInfo(saveErrorInfo);
|
|
65531
65552
|
return result;
|
|
65532
65553
|
}
|
|
65533
65554
|
// slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
|
|
65534
|
-
else if (
|
|
65555
|
+
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
|
|
65535
65556
|
resetErrorInfo(saveErrorInfo);
|
|
65536
65557
|
return result;
|
|
65537
65558
|
}
|
|
@@ -65675,7 +65696,7 @@ var ts;
|
|
|
65675
65696
|
return varianceResult;
|
|
65676
65697
|
}
|
|
65677
65698
|
}
|
|
65678
|
-
else if (isReadonlyArrayType(target) ?
|
|
65699
|
+
else if (isReadonlyArrayType(target) ? isArrayOrTupleType(source) : isArrayType(target) && isTupleType(source) && !source.target.readonly) {
|
|
65679
65700
|
if (relation !== identityRelation) {
|
|
65680
65701
|
return isRelatedTo(getIndexTypeOfType(source, numberType) || anyType, getIndexTypeOfType(target, numberType) || anyType, 3 /* Both */, reportErrors);
|
|
65681
65702
|
}
|
|
@@ -66051,7 +66072,7 @@ var ts;
|
|
|
66051
66072
|
}
|
|
66052
66073
|
var result = -1 /* True */;
|
|
66053
66074
|
if (isTupleType(target)) {
|
|
66054
|
-
if (
|
|
66075
|
+
if (isArrayOrTupleType(source)) {
|
|
66055
66076
|
if (!target.target.readonly && (isReadonlyArrayType(source) || isTupleType(source) && source.target.readonly)) {
|
|
66056
66077
|
return 0 /* False */;
|
|
66057
66078
|
}
|
|
@@ -67012,6 +67033,9 @@ var ts;
|
|
|
67012
67033
|
function isReadonlyArrayType(type) {
|
|
67013
67034
|
return !!(ts.getObjectFlags(type) & 4 /* Reference */) && type.target === globalReadonlyArrayType;
|
|
67014
67035
|
}
|
|
67036
|
+
function isArrayOrTupleType(type) {
|
|
67037
|
+
return isArrayType(type) || isTupleType(type);
|
|
67038
|
+
}
|
|
67015
67039
|
function isMutableArrayOrTuple(type) {
|
|
67016
67040
|
return isArrayType(type) && !isReadonlyArrayType(type) || isTupleType(type) && !type.target.readonly;
|
|
67017
67041
|
}
|
|
@@ -67463,7 +67487,7 @@ var ts;
|
|
|
67463
67487
|
else if (type.flags & 2097152 /* Intersection */) {
|
|
67464
67488
|
result = getIntersectionType(ts.sameMap(type.types, getWidenedType));
|
|
67465
67489
|
}
|
|
67466
|
-
else if (
|
|
67490
|
+
else if (isArrayOrTupleType(type)) {
|
|
67467
67491
|
result = createTypeReference(type.target, ts.sameMap(getTypeArguments(type), getWidenedType));
|
|
67468
67492
|
}
|
|
67469
67493
|
if (result && context === undefined) {
|
|
@@ -67500,7 +67524,7 @@ var ts;
|
|
|
67500
67524
|
}
|
|
67501
67525
|
}
|
|
67502
67526
|
}
|
|
67503
|
-
if (
|
|
67527
|
+
if (isArrayOrTupleType(type)) {
|
|
67504
67528
|
for (var _b = 0, _c = getTypeArguments(type); _b < _c.length; _b++) {
|
|
67505
67529
|
var t = _c[_b];
|
|
67506
67530
|
if (reportWideningErrorsInType(t)) {
|
|
@@ -68561,7 +68585,7 @@ var ts;
|
|
|
68561
68585
|
}
|
|
68562
68586
|
// Infer from the members of source and target only if the two types are possibly related
|
|
68563
68587
|
if (!typesDefinitelyUnrelated(source, target)) {
|
|
68564
|
-
if (
|
|
68588
|
+
if (isArrayOrTupleType(source)) {
|
|
68565
68589
|
if (isTupleType(target)) {
|
|
68566
68590
|
var sourceArity = getTypeReferenceArity(source);
|
|
68567
68591
|
var targetArity = getTypeReferenceArity(target);
|