Skip to content

Commit 8c085fc

Browse files
ahejlsbergvladima
authored andcommitted
Only infer *to* type references that have explicit type arguments
1 parent c531b5c commit 8c085fc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/compiler/checker.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6011,9 +6011,12 @@ namespace ts {
60116011
}
60126012
else {
60136013
source = getApparentType(source);
6014-
if (source.flags & TypeFlags.ObjectType && (target.flags & (TypeFlags.Reference | TypeFlags.Tuple) ||
6015-
(target.flags & TypeFlags.Anonymous) && target.symbol && target.symbol.flags & (SymbolFlags.Method | SymbolFlags.TypeLiteral | SymbolFlags.Class))) {
6016-
// If source is an object type, and target is a type reference, a tuple type, the type of a method, or a type literal, infer from members
6014+
if (source.flags & TypeFlags.ObjectType && (
6015+
target.flags & TypeFlags.Reference && (<TypeReference>target).typeArguments ||
6016+
target.flags & TypeFlags.Tuple ||
6017+
target.flags & TypeFlags.Anonymous && target.symbol && target.symbol.flags & (SymbolFlags.Method | SymbolFlags.TypeLiteral | SymbolFlags.Class))) {
6018+
// If source is an object type, and target is a type reference with type arguments, a tuple type,
6019+
// the type of a method, or a type literal, infer from members
60176020
if (isInProcess(source, target)) {
60186021
return;
60196022
}

0 commit comments

Comments
 (0)