@@ -3708,7 +3708,7 @@ namespace ts {
37083708 return createTypeParameterDeclaration(name, constraintNode, defaultParameterNode);
37093709 }
37103710
3711- function typeParameterToDeclaration(type: TypeParameter, context: NodeBuilderContext, constraint = getConstraintFromTypeParameter (type)): TypeParameterDeclaration {
3711+ function typeParameterToDeclaration(type: TypeParameter, context: NodeBuilderContext, constraint = getConstraintOfTypeParameter (type)): TypeParameterDeclaration {
37123712 const constraintNode = constraint && typeToTypeNodeHelper(constraint, context);
37133713 return typeParameterToDeclarationWithConstraint(type, context, constraintNode);
37143714 }
@@ -4356,28 +4356,23 @@ namespace ts {
43564356 return i;
43574357 }
43584358 }
4359-
43604359 return -1;
43614360 }
43624361
43634362 function hasType(target: TypeSystemEntity, propertyName: TypeSystemPropertyName): boolean {
4364- if (propertyName === TypeSystemPropertyName.Type) {
4365- return !!getSymbolLinks(<Symbol>target).type;
4366- }
4367- if (propertyName === TypeSystemPropertyName.DeclaredType) {
4368- return !!getSymbolLinks(<Symbol>target).declaredType;
4369- }
4370- if (propertyName === TypeSystemPropertyName.ResolvedBaseConstructorType) {
4371- return !!(<InterfaceType>target).resolvedBaseConstructorType;
4363+ switch (propertyName) {
4364+ case TypeSystemPropertyName.Type:
4365+ return !!getSymbolLinks(<Symbol>target).type;
4366+ case TypeSystemPropertyName.DeclaredType:
4367+ return !!getSymbolLinks(<Symbol>target).declaredType;
4368+ case TypeSystemPropertyName.ResolvedBaseConstructorType:
4369+ return !!(<InterfaceType>target).resolvedBaseConstructorType;
4370+ case TypeSystemPropertyName.ResolvedReturnType:
4371+ return !!(<Signature>target).resolvedReturnType;
4372+ case TypeSystemPropertyName.ImmediateBaseConstraint:
4373+ const bc = (<Type>target).immediateBaseConstraint;
4374+ return !!bc && bc !== circularConstraintType;
43724375 }
4373- if (propertyName === TypeSystemPropertyName.ResolvedReturnType) {
4374- return !!(<Signature>target).resolvedReturnType;
4375- }
4376- if (propertyName === TypeSystemPropertyName.ImmediateBaseConstraint) {
4377- const bc = (<Type>target).immediateBaseConstraint;
4378- return !!bc && bc !== circularConstraintType;
4379- }
4380-
43814376 return Debug.fail("Unhandled TypeSystemPropertyName " + propertyName);
43824377 }
43834378
@@ -9166,7 +9161,7 @@ namespace ts {
91669161 return type.simplified = substituteIndexedMappedType(objectType, type);
91679162 }
91689163 if (objectType.flags & TypeFlags.TypeParameter) {
9169- const constraint = getConstraintFromTypeParameter (objectType as TypeParameter);
9164+ const constraint = getConstraintOfTypeParameter (objectType as TypeParameter);
91709165 if (constraint && isGenericMappedType(constraint)) {
91719166 return type.simplified = substituteIndexedMappedType(constraint, type);
91729167 }
@@ -12113,7 +12108,7 @@ namespace ts {
1211312108 }
1211412109
1211512110 function isUnconstrainedTypeParameter(type: Type) {
12116- return type.flags & TypeFlags.TypeParameter && !getConstraintFromTypeParameter (<TypeParameter>type);
12111+ return type.flags & TypeFlags.TypeParameter && !getConstraintOfTypeParameter (<TypeParameter>type);
1211712112 }
1211812113
1211912114 function isTypeReferenceWithGenericArguments(type: Type): boolean {
@@ -17642,7 +17637,7 @@ namespace ts {
1764217637 }
1764317638
1764417639 const thisType = getTypeFromTypeNode(thisParameter.type);
17645- enclosingClass = ((thisType.flags & TypeFlags.TypeParameter) ? getConstraintFromTypeParameter (<TypeParameter>thisType) : thisType) as InterfaceType;
17640+ enclosingClass = ((thisType.flags & TypeFlags.TypeParameter) ? getConstraintOfTypeParameter (<TypeParameter>thisType) : thisType) as InterfaceType;
1764617641 }
1764717642 // No further restrictions for static properties
1764817643 if (flags & ModifierFlags.Static) {
@@ -19283,7 +19278,7 @@ namespace ts {
1928319278 typeArguments.pop();
1928419279 }
1928519280 while (typeArguments.length < typeParameters.length) {
19286- typeArguments.push(getConstraintFromTypeParameter (typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(isInJavaScriptFile(node)));
19281+ typeArguments.push(getConstraintOfTypeParameter (typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(isInJavaScriptFile(node)));
1928719282 }
1928819283 const instantiated = createSignatureInstantiation(candidate, typeArguments);
1928919284 candidates[bestIndex] = instantiated;
@@ -25185,7 +25180,7 @@ namespace ts {
2518525180 // If the type parameter node does not have an identical constraint as the resolved
2518625181 // type parameter at this position, we report an error.
2518725182 const sourceConstraint = source.constraint && getTypeFromTypeNode(source.constraint);
25188- const targetConstraint = getConstraintFromTypeParameter (target);
25183+ const targetConstraint = getConstraintOfTypeParameter (target);
2518925184 if (sourceConstraint) {
2519025185 // relax check if later interface augmentation has no constraint
2519125186 if (!targetConstraint || !isTypeIdenticalTo(sourceConstraint, targetConstraint)) {
0 commit comments