Re-enable weak type check for intersection props

Previously, intersections disabled the weak type check for their
constituents, and all properties (recursively) of their constituents.

Also add test for this case.
This commit is contained in:
Nathan Shively-Sanders
2017-05-26 13:39:53 -07:00
parent 548f92ad34
commit f9a05a1f9d
4 changed files with 58 additions and 1 deletions

View File

@@ -9352,7 +9352,10 @@ namespace ts {
}
return Ternary.False;
}
const saveDisableWeakTypeErrors = disableWeakTypeErrors;
disableWeakTypeErrors = false;
const related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors);
disableWeakTypeErrors = saveDisableWeakTypeErrors;
if (!related) {
if (reportErrors) {
reportError(Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp));