mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-07 05:41:22 -06:00
Exception for 'any' constraint only applies to type parameters
This commit is contained in:
parent
5e1330e665
commit
ce6fd5eeaa
@ -10740,7 +10740,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
const constraint = getConstraintForRelation(<TypeParameter>source);
|
||||
if (!constraint || constraint.flags & TypeFlags.Any) {
|
||||
if (!constraint || (source.flags & TypeFlags.TypeParameter && constraint.flags & TypeFlags.Any)) {
|
||||
// A type variable with no constraint is not related to the non-primitive object type.
|
||||
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~TypeFlags.NonPrimitive))) {
|
||||
errorInfo = saveErrorInfo;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user