Skip to content

Commit

Permalink
Actually change fallback to candidate type otherwise any narrowing br…
Browse files Browse the repository at this point in the history
…eaks
  • Loading branch information
jack-williams committed Sep 18, 2018
1 parent e826824 commit a55d6fb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15268,7 +15268,7 @@ namespace ts {
case "object":
return type.flags & TypeFlags.Unknown ? getUnionType([nonPrimitiveType, nullType]) : type;
default:
return typeofTypesByName.get(text) || unknownType;
return typeofTypesByName.get(text) || type;
}
};
if (!(hasDefaultClause || (type.flags & TypeFlags.Union))) {
Expand Down

0 comments on commit a55d6fb

Please sign in to comment.