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 b94c513 commit 595cb11Copy full SHA for 595cb11
src/compiler/checker.ts
@@ -8964,6 +8964,13 @@ namespace ts {
8964
(isTypeSubsetOf(globalObjectType, target) || (!isComparingJsxAttributes && isEmptyObjectType(target)))) {
8965
return false;
8966
}
8967
+ if (target.flags & TypeFlags.Union) {
8968
+ const discriminantType = findMatchingDiscriminantType(source, target as UnionType);
8969
+ if (discriminantType) {
8970
+ // check excess properties against discriminant type only, not the entire union
8971
+ return hasExcessProperties(source, discriminantType, reportErrors);
8972
+ }
8973
8974
for (const prop of getPropertiesOfObjectType(source)) {
8975
if (!isKnownProperty(target, prop.name, isComparingJsxAttributes)) {
8976
if (reportErrors) {
0 commit comments