@@ -177,6 +177,7 @@ namespace ts {
177
177
const enum ContextFlags {
178
178
None = 0,
179
179
Signature = 1 << 0, // Obtaining contextual signature
180
+ NoConstraints = 1 << 1, // Don't obtain type variable constraints
180
181
}
181
182
182
183
const enum AccessFlags {
@@ -19193,7 +19194,7 @@ namespace ts {
19193
19194
getContextualTypeForObjectLiteralMethod(node, contextFlags) :
19194
19195
getContextualType(node, contextFlags);
19195
19196
const instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
19196
- if (instantiatedType) {
19197
+ if (instantiatedType && !(contextFlags && contextFlags & ContextFlags.NoConstraints && instantiatedType.flags & TypeFlags.TypeVariable) ) {
19197
19198
const apparentType = mapType(instantiatedType, getApparentType, /*noReductions*/ true);
19198
19199
if (apparentType.flags & TypeFlags.Union) {
19199
19200
if (isObjectLiteralExpression(node)) {
@@ -25098,8 +25099,8 @@ namespace ts {
25098
25099
const constructSignature = getSingleSignature(type, SignatureKind.Construct, /*allowMembers*/ true);
25099
25100
const signature = callSignature || constructSignature;
25100
25101
if (signature && signature.typeParameters) {
25101
- const contextualType = getApparentTypeOfContextualType(<Expression>node);
25102
- if (contextualType && !isMixinConstructorType(contextualType) ) {
25102
+ const contextualType = getApparentTypeOfContextualType(<Expression>node, ContextFlags.NoConstraints );
25103
+ if (contextualType) {
25103
25104
const contextualSignature = getSingleSignature(getNonNullableType(contextualType), callSignature ? SignatureKind.Call : SignatureKind.Construct, /*allowMembers*/ false);
25104
25105
if (contextualSignature && !contextualSignature.typeParameters) {
25105
25106
if (checkMode & CheckMode.SkipGenericFunctions) {
0 commit comments