File tree 2 files changed +6
-15
lines changed
2 files changed +6
-15
lines changed Original file line number Diff line number Diff line change @@ -249,7 +249,7 @@ namespace ts {
249
249
getTypeOfSymbol,
250
250
getResolvedSymbol,
251
251
getIndexTypeOfStructuredType,
252
- getConstraintFromTypeParameter ,
252
+ getConstraintOfTypeParameter ,
253
253
getFirstIdentifier,
254
254
),
255
255
getAmbientModules,
@@ -6951,21 +6951,12 @@ namespace ts {
6951
6951
return undefined;
6952
6952
}
6953
6953
6954
- function getBaseConstraintOfInstantiableNonPrimitiveUnionOrIntersection (type: Type) {
6954
+ function getBaseConstraintOfType (type: Type): Type | undefined {
6955
6955
if (type.flags & (TypeFlags.InstantiableNonPrimitive | TypeFlags.UnionOrIntersection)) {
6956
6956
const constraint = getResolvedBaseConstraint(<InstantiableType | UnionOrIntersectionType>type);
6957
- if (constraint !== noConstraintType && constraint !== circularConstraintType) {
6958
- return constraint;
6959
- }
6960
- }
6961
- }
6962
-
6963
- function getBaseConstraintOfType(type: Type): Type | undefined {
6964
- const constraint = getBaseConstraintOfInstantiableNonPrimitiveUnionOrIntersection(type);
6965
- if (!constraint && type.flags & TypeFlags.Index) {
6966
- return keyofConstraintType;
6957
+ return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : undefined;
6967
6958
}
6968
- return constraint ;
6959
+ return type.flags & TypeFlags.Index ? keyofConstraintType : undefined ;
6969
6960
}
6970
6961
6971
6962
/**
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ namespace ts {
9
9
getTypeOfSymbol : ( sym : Symbol ) => Type ,
10
10
getResolvedSymbol : ( node : Node ) => Symbol ,
11
11
getIndexTypeOfStructuredType : ( type : Type , kind : IndexKind ) => Type | undefined ,
12
- getConstraintFromTypeParameter : ( typeParameter : TypeParameter ) => Type | undefined ,
12
+ getConstraintOfTypeParameter : ( typeParameter : TypeParameter ) => Type | undefined ,
13
13
getFirstIdentifier : ( node : EntityNameOrEntityNameExpression ) => Identifier ) {
14
14
15
15
return getSymbolWalker ;
@@ -93,7 +93,7 @@ namespace ts {
93
93
}
94
94
95
95
function visitTypeParameter ( type : TypeParameter ) : void {
96
- visitType ( getConstraintFromTypeParameter ( type ) ) ;
96
+ visitType ( getConstraintOfTypeParameter ( type ) ) ;
97
97
}
98
98
99
99
function visitUnionOrIntersectionType ( type : UnionOrIntersectionType ) : void {
You can’t perform that action at this time.
0 commit comments