File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -249,7 +249,7 @@ namespace ts {
249249 getTypeOfSymbol,
250250 getResolvedSymbol,
251251 getIndexTypeOfStructuredType,
252- getConstraintFromTypeParameter ,
252+ getConstraintOfTypeParameter ,
253253 getFirstIdentifier,
254254 ),
255255 getAmbientModules,
@@ -6951,21 +6951,12 @@ namespace ts {
69516951 return undefined;
69526952 }
69536953
6954- function getBaseConstraintOfInstantiableNonPrimitiveUnionOrIntersection (type: Type) {
6954+ function getBaseConstraintOfType (type: Type): Type | undefined {
69556955 if (type.flags & (TypeFlags.InstantiableNonPrimitive | TypeFlags.UnionOrIntersection)) {
69566956 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;
69676958 }
6968- return constraint ;
6959+ return type.flags & TypeFlags.Index ? keyofConstraintType : undefined ;
69696960 }
69706961
69716962 /**
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ namespace ts {
99 getTypeOfSymbol : ( sym : Symbol ) => Type ,
1010 getResolvedSymbol : ( node : Node ) => Symbol ,
1111 getIndexTypeOfStructuredType : ( type : Type , kind : IndexKind ) => Type | undefined ,
12- getConstraintFromTypeParameter : ( typeParameter : TypeParameter ) => Type | undefined ,
12+ getConstraintOfTypeParameter : ( typeParameter : TypeParameter ) => Type | undefined ,
1313 getFirstIdentifier : ( node : EntityNameOrEntityNameExpression ) => Identifier ) {
1414
1515 return getSymbolWalker ;
@@ -93,7 +93,7 @@ namespace ts {
9393 }
9494
9595 function visitTypeParameter ( type : TypeParameter ) : void {
96- visitType ( getConstraintFromTypeParameter ( type ) ) ;
96+ visitType ( getConstraintOfTypeParameter ( type ) ) ;
9797 }
9898
9999 function visitUnionOrIntersectionType ( type : UnionOrIntersectionType ) : void {
You can’t perform that action at this time.
0 commit comments