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:
parent
2ca1de514a
commit
adefdc7953
1 changed files with 1 additions and 1 deletions
|
@ -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)) {
|
||||
|
|
Loading…
Reference in a new issue