mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-06 23:59:42 -05:00
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.
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user