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 69affb7 commit 74d3e2aCopy full SHA for 74d3e2a
src/compiler/checker.ts
@@ -12533,8 +12533,8 @@ namespace ts {
12533
12534
// Keep this up-to-date with the same logic within `getApparentTypeOfContextualType`, since they should behave similarly
12535
function findMatchingDiscriminantType(source: Type, target: Type) {
12536
- if (target.flags & TypeFlags.Union) {
12537
- const sourceProperties = getPropertiesOfObjectType(source);
+ if (target.flags & TypeFlags.Union && source.flags & (TypeFlags.Intersection | TypeFlags.Object)) {
+ const sourceProperties = getPropertiesOfType(source);
12538
if (sourceProperties) {
12539
const sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target);
12540
if (sourcePropertiesFiltered) {
0 commit comments