We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 581f52a commit 16d80ebCopy full SHA for 16d80eb
src/compiler/checker.ts
@@ -6479,6 +6479,10 @@ namespace ts {
6479
assumeTrue = !assumeTrue;
6480
}
6481
const typeInfo = primitiveTypeInfo[right.text];
6482
+ // Don't narrow `undefined`
6483
+ if (typeInfo && typeInfo.type === undefinedType) {
6484
+ return type;
6485
+ }
6486
// If the type to be narrowed is any and we're checking a primitive with assumeTrue=true, return the primitive
6487
if (!!(type.flags & TypeFlags.Any) && typeInfo && assumeTrue) {
6488
return typeInfo.type;
0 commit comments