Skip to content

Commit 7a19b66

Browse files
committed
Don't propagate 'never' types in type inference
1 parent 7f01050 commit 7a19b66

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11525,10 +11525,10 @@ namespace ts {
1152511525
if (!couldContainTypeVariables(target)) {
1152611526
return;
1152711527
}
11528-
if (source.flags & (TypeFlags.Any | TypeFlags.Never) && source !== silentNeverType) {
11529-
// We are inferring from 'any' or 'never'. We want to infer this type for every type parameter
11530-
// referenced in the target type, so we record the propagation type and infer from the target
11531-
// to itself. Then, as we find candidates we substitute the propagation type.
11528+
if (source.flags & TypeFlags.Any) {
11529+
// We are inferring from an 'any' type. We want to infer this type for every type parameter
11530+
// referenced in the target type, so we record it as the propagation type and infer from the
11531+
// target to itself. Then, as we find candidates we substitute the propagation type.
1153211532
const savePropagationType = propagationType;
1153311533
propagationType = source;
1153411534
inferFromTypes(target, target);

0 commit comments

Comments
 (0)