@@ -3708,7 +3708,7 @@ namespace ts {
3708
3708
return createTypeParameterDeclaration(name, constraintNode, defaultParameterNode);
3709
3709
}
3710
3710
3711
- function typeParameterToDeclaration(type: TypeParameter, context: NodeBuilderContext, constraint = getConstraintFromTypeParameter (type)): TypeParameterDeclaration {
3711
+ function typeParameterToDeclaration(type: TypeParameter, context: NodeBuilderContext, constraint = getConstraintOfTypeParameter (type)): TypeParameterDeclaration {
3712
3712
const constraintNode = constraint && typeToTypeNodeHelper(constraint, context);
3713
3713
return typeParameterToDeclarationWithConstraint(type, context, constraintNode);
3714
3714
}
@@ -4356,28 +4356,23 @@ namespace ts {
4356
4356
return i;
4357
4357
}
4358
4358
}
4359
-
4360
4359
return -1;
4361
4360
}
4362
4361
4363
4362
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;
4372
4375
}
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
-
4381
4376
return Debug.fail("Unhandled TypeSystemPropertyName " + propertyName);
4382
4377
}
4383
4378
@@ -9166,7 +9161,7 @@ namespace ts {
9166
9161
return type.simplified = substituteIndexedMappedType(objectType, type);
9167
9162
}
9168
9163
if (objectType.flags & TypeFlags.TypeParameter) {
9169
- const constraint = getConstraintFromTypeParameter (objectType as TypeParameter);
9164
+ const constraint = getConstraintOfTypeParameter (objectType as TypeParameter);
9170
9165
if (constraint && isGenericMappedType(constraint)) {
9171
9166
return type.simplified = substituteIndexedMappedType(constraint, type);
9172
9167
}
@@ -12113,7 +12108,7 @@ namespace ts {
12113
12108
}
12114
12109
12115
12110
function isUnconstrainedTypeParameter(type: Type) {
12116
- return type.flags & TypeFlags.TypeParameter && !getConstraintFromTypeParameter (<TypeParameter>type);
12111
+ return type.flags & TypeFlags.TypeParameter && !getConstraintOfTypeParameter (<TypeParameter>type);
12117
12112
}
12118
12113
12119
12114
function isTypeReferenceWithGenericArguments(type: Type): boolean {
@@ -17642,7 +17637,7 @@ namespace ts {
17642
17637
}
17643
17638
17644
17639
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;
17646
17641
}
17647
17642
// No further restrictions for static properties
17648
17643
if (flags & ModifierFlags.Static) {
@@ -19283,7 +19278,7 @@ namespace ts {
19283
19278
typeArguments.pop();
19284
19279
}
19285
19280
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)));
19287
19282
}
19288
19283
const instantiated = createSignatureInstantiation(candidate, typeArguments);
19289
19284
candidates[bestIndex] = instantiated;
@@ -25185,7 +25180,7 @@ namespace ts {
25185
25180
// If the type parameter node does not have an identical constraint as the resolved
25186
25181
// type parameter at this position, we report an error.
25187
25182
const sourceConstraint = source.constraint && getTypeFromTypeNode(source.constraint);
25188
- const targetConstraint = getConstraintFromTypeParameter (target);
25183
+ const targetConstraint = getConstraintOfTypeParameter (target);
25189
25184
if (sourceConstraint) {
25190
25185
// relax check if later interface augmentation has no constraint
25191
25186
if (!targetConstraint || !isTypeIdenticalTo(sourceConstraint, targetConstraint)) {
0 commit comments