From adefdc79538d171435ddb8a37f5a543556803495 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 18 Apr 2017 14:56:11 -0700 Subject: [PATCH] Unknown properties are assignable to Object unions For the last week or so they have been treated as excess properties when assigning to a union type containing Object, but not when assigning directly to Object type. --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 353356c208b..c0e3c490831 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -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)) {