Merge pull request #15257 from Microsoft/unknown-properties-are-assignable-to-Object-in-union

Unknown properties are assignable to `Object` in union
This commit is contained in:
Nathan Shively-Sanders
2017-04-18 15:21:46 -07:00
committed by GitHub
5 changed files with 38 additions and 1 deletions

View File

@@ -8708,7 +8708,7 @@ namespace ts {
if (maybeTypeOfKind(target, TypeFlags.Object) && !(getObjectFlags(target) & ObjectFlags.ObjectLiteralPatternWithComputedProperties)) {
const isComparingJsxAttributes = !!(source.flags & TypeFlags.JsxAttributes);
if ((relation === assignableRelation || relation === comparableRelation) &&
(target === globalObjectType || (!isComparingJsxAttributes && isEmptyObjectType(target)))) {
(isTypeSubsetOf(globalObjectType, target) || (!isComparingJsxAttributes && isEmptyObjectType(target)))) {
return false;
}
for (const prop of getPropertiesOfObjectType(source)) {