Skip to content

Commit adefdc7

Browse files
committed
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.
1 parent 2ca1de5 commit adefdc7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8708,7 +8708,7 @@ namespace ts {
87088708
if (maybeTypeOfKind(target, TypeFlags.Object) && !(getObjectFlags(target) & ObjectFlags.ObjectLiteralPatternWithComputedProperties)) {
87098709
const isComparingJsxAttributes = !!(source.flags & TypeFlags.JsxAttributes);
87108710
if ((relation === assignableRelation || relation === comparableRelation) &&
8711-
(target === globalObjectType || (!isComparingJsxAttributes && isEmptyObjectType(target)))) {
8711+
(isTypeSubsetOf(globalObjectType, target) || (!isComparingJsxAttributes && isEmptyObjectType(target)))) {
87128712
return false;
87138713
}
87148714
for (const prop of getPropertiesOfObjectType(source)) {

0 commit comments

Comments
 (0)