@@ -23597,7 +23597,7 @@ var ts;
23597
23597
})(ts || (ts = {}));
23598
23598
var ts;
23599
23599
(function (ts) {
23600
- function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignature, getReturnTypeOfSignature, getBaseTypes, resolveStructuredTypeMembers, getTypeOfSymbol, getResolvedSymbol, getIndexTypeOfStructuredType, getConstraintFromTypeParameter , getFirstIdentifier) {
23600
+ function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignature, getReturnTypeOfSignature, getBaseTypes, resolveStructuredTypeMembers, getTypeOfSymbol, getResolvedSymbol, getIndexTypeOfStructuredType, getConstraintOfTypeParameter , getFirstIdentifier) {
23601
23601
return getSymbolWalker;
23602
23602
function getSymbolWalker(accept) {
23603
23603
if (accept === void 0) { accept = function () { return true; }; }
@@ -23670,7 +23670,7 @@ var ts;
23670
23670
ts.forEach(type.typeArguments, visitType);
23671
23671
}
23672
23672
function visitTypeParameter(type) {
23673
- visitType(getConstraintFromTypeParameter (type));
23673
+ visitType(getConstraintOfTypeParameter (type));
23674
23674
}
23675
23675
function visitUnionOrIntersectionType(type) {
23676
23676
ts.forEach(type.types, visitType);
@@ -23973,7 +23973,7 @@ var ts;
23973
23973
getEmitResolver: getEmitResolver,
23974
23974
getExportsOfModule: getExportsOfModuleAsArray,
23975
23975
getExportsAndPropertiesOfModule: getExportsAndPropertiesOfModule,
23976
- getSymbolWalker: ts.createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignature, getReturnTypeOfSignature, getBaseTypes, resolveStructuredTypeMembers, getTypeOfSymbol, getResolvedSymbol, getIndexTypeOfStructuredType, getConstraintFromTypeParameter , getFirstIdentifier),
23976
+ getSymbolWalker: ts.createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignature, getReturnTypeOfSignature, getBaseTypes, resolveStructuredTypeMembers, getTypeOfSymbol, getResolvedSymbol, getIndexTypeOfStructuredType, getConstraintOfTypeParameter , getFirstIdentifier),
23977
23977
getAmbientModules: getAmbientModules,
23978
23978
getAllAttributesTypeFromJsxOpeningLikeElement: function (nodeIn) {
23979
23979
var node = ts.getParseTreeNode(nodeIn, ts.isJsxOpeningLikeElement);
@@ -26710,7 +26710,7 @@ var ts;
26710
26710
return ts.createTypeParameterDeclaration(name, constraintNode, defaultParameterNode);
26711
26711
}
26712
26712
function typeParameterToDeclaration(type, context, constraint) {
26713
- if (constraint === void 0) { constraint = getConstraintFromTypeParameter (type); }
26713
+ if (constraint === void 0) { constraint = getConstraintOfTypeParameter (type); }
26714
26714
var constraintNode = constraint && typeToTypeNodeHelper(constraint, context);
26715
26715
return typeParameterToDeclarationWithConstraint(type, context, constraintNode);
26716
26716
}
@@ -27225,23 +27225,19 @@ var ts;
27225
27225
return -1;
27226
27226
}
27227
27227
function hasType(target, propertyName) {
27228
- if (propertyName === 0) {
27229
- return !!getSymbolLinks(target).type;
27230
- }
27231
- if (propertyName === 2) {
27232
- return !!getSymbolLinks(target).declaredType;
27233
- }
27234
- if (propertyName === 1) {
27235
- return !!target.resolvedBaseConstructorType;
27236
- }
27237
- if (propertyName === 3) {
27238
- return !!target.resolvedReturnType;
27239
- }
27240
- if (propertyName === 4) {
27241
- var bc = target.immediateBaseConstraint;
27242
- return !!bc && bc !== circularConstraintType;
27228
+ switch (propertyName) {
27229
+ case 0:
27230
+ return !!getSymbolLinks(target).type;
27231
+ case 2:
27232
+ return !!getSymbolLinks(target).declaredType;
27233
+ case 1:
27234
+ return !!target.resolvedBaseConstructorType;
27235
+ case 3:
27236
+ return !!target.resolvedReturnType;
27237
+ case 4:
27238
+ return !!target.immediateBaseConstraint;
27243
27239
}
27244
- return ts.Debug.fail("Unhandled TypeSystemPropertyName " + propertyName);
27240
+ return ts.Debug.assertNever( propertyName);
27245
27241
}
27246
27242
function popTypeResolution() {
27247
27243
resolutionTargets.pop();
@@ -29299,20 +29295,12 @@ var ts;
29299
29295
}
29300
29296
return undefined;
29301
29297
}
29302
- function getBaseConstraintOfInstantiableNonPrimitiveUnionOrIntersection (type) {
29298
+ function getBaseConstraintOfType (type) {
29303
29299
if (type.flags & (14745600 | 786432)) {
29304
29300
var constraint = getResolvedBaseConstraint(type);
29305
- if (constraint !== noConstraintType && constraint !== circularConstraintType) {
29306
- return constraint;
29307
- }
29308
- }
29309
- }
29310
- function getBaseConstraintOfType(type) {
29311
- var constraint = getBaseConstraintOfInstantiableNonPrimitiveUnionOrIntersection(type);
29312
- if (!constraint && type.flags & 1048576) {
29313
- return keyofConstraintType;
29301
+ return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : undefined;
29314
29302
}
29315
- return constraint ;
29303
+ return type.flags & 1048576 ? keyofConstraintType : undefined ;
29316
29304
}
29317
29305
function getBaseConstraintOrType(type) {
29318
29306
return getBaseConstraintOfType(type) || type;
@@ -29321,29 +29309,24 @@ var ts;
29321
29309
return getResolvedBaseConstraint(type) !== circularConstraintType;
29322
29310
}
29323
29311
function getResolvedBaseConstraint(type) {
29324
- var circular;
29325
- if (!type.resolvedBaseConstraint) {
29326
- var constraint = getBaseConstraint(type);
29327
- type.resolvedBaseConstraint = circular ? circularConstraintType : getTypeWithThisArgument(constraint || noConstraintType, type);
29312
+ return type.resolvedBaseConstraint ||
29313
+ (type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), type));
29314
+ function getImmediateBaseConstraint(t) {
29315
+ if (!t.immediateBaseConstraint) {
29316
+ if (!pushTypeResolution(t, 4)) {
29317
+ return circularConstraintType;
29318
+ }
29319
+ var result = computeBaseConstraint(getSimplifiedType(t));
29320
+ if (!popTypeResolution()) {
29321
+ result = circularConstraintType;
29322
+ }
29323
+ t.immediateBaseConstraint = result || noConstraintType;
29324
+ }
29325
+ return t.immediateBaseConstraint;
29328
29326
}
29329
- return type.resolvedBaseConstraint;
29330
29327
function getBaseConstraint(t) {
29331
- if (t.immediateBaseConstraint) {
29332
- return t.immediateBaseConstraint === noConstraintType ? undefined : t.immediateBaseConstraint;
29333
- }
29334
- if (!pushTypeResolution(t, 4)) {
29335
- circular = true;
29336
- t.immediateBaseConstraint = circularConstraintType;
29337
- return undefined;
29338
- }
29339
- var result = computeBaseConstraint(getSimplifiedType(t));
29340
- if (!popTypeResolution()) {
29341
- circular = true;
29342
- t.immediateBaseConstraint = circularConstraintType;
29343
- return undefined;
29344
- }
29345
- t.immediateBaseConstraint = !result ? noConstraintType : result;
29346
- return result;
29328
+ var c = getImmediateBaseConstraint(t);
29329
+ return c !== noConstraintType && c !== circularConstraintType ? c : undefined;
29347
29330
}
29348
29331
function computeBaseConstraint(t) {
29349
29332
if (t.flags & 65536) {
@@ -31107,7 +31090,7 @@ var ts;
31107
31090
return type.simplified = substituteIndexedMappedType(objectType, type);
31108
31091
}
31109
31092
if (objectType.flags & 65536) {
31110
- var constraint = getConstraintFromTypeParameter (objectType);
31093
+ var constraint = getConstraintOfTypeParameter (objectType);
31111
31094
if (constraint && isGenericMappedType(constraint)) {
31112
31095
return type.simplified = substituteIndexedMappedType(constraint, type);
31113
31096
}
@@ -33569,7 +33552,7 @@ var ts;
33569
33552
return false;
33570
33553
}
33571
33554
function isUnconstrainedTypeParameter(type) {
33572
- return type.flags & 65536 && !getConstraintFromTypeParameter (type);
33555
+ return type.flags & 65536 && !getConstraintOfTypeParameter (type);
33573
33556
}
33574
33557
function isTypeReferenceWithGenericArguments(type) {
33575
33558
return !!(ts.getObjectFlags(type) & 4) && ts.some(type.typeArguments, function (t) { return isUnconstrainedTypeParameter(t) || isTypeReferenceWithGenericArguments(t); });
@@ -37819,7 +37802,7 @@ var ts;
37819
37802
return false;
37820
37803
}
37821
37804
var thisType = getTypeFromTypeNode(thisParameter.type);
37822
- enclosingClass = ((thisType.flags & 65536) ? getConstraintFromTypeParameter (thisType) : thisType);
37805
+ enclosingClass = ((thisType.flags & 65536) ? getConstraintOfTypeParameter (thisType) : thisType);
37823
37806
}
37824
37807
if (flags & 32) {
37825
37808
return true;
@@ -38940,7 +38923,7 @@ var ts;
38940
38923
typeArguments.pop();
38941
38924
}
38942
38925
while (typeArguments.length < typeParameters.length) {
38943
- typeArguments.push(getConstraintFromTypeParameter (typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(ts.isInJavaScriptFile(node)));
38926
+ typeArguments.push(getConstraintOfTypeParameter (typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(ts.isInJavaScriptFile(node)));
38944
38927
}
38945
38928
var instantiated = createSignatureInstantiation(candidate, typeArguments);
38946
38929
candidates[bestIndex] = instantiated;
@@ -43382,7 +43365,7 @@ var ts;
43382
43365
return false;
43383
43366
}
43384
43367
var sourceConstraint = source.constraint && getTypeFromTypeNode(source.constraint);
43385
- var targetConstraint = getConstraintFromTypeParameter (target);
43368
+ var targetConstraint = getConstraintOfTypeParameter (target);
43386
43369
if (sourceConstraint) {
43387
43370
if (!targetConstraint || !isTypeIdenticalTo(sourceConstraint, targetConstraint)) {
43388
43371
return false;
0 commit comments