mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Don't allow properties inherited from Object to be automatically included in TSX attributes
This commit is contained in:
@@ -10060,7 +10060,7 @@ namespace ts {
|
||||
for (const prop of props) {
|
||||
// Is there a corresponding property in the element attributes type? Skip checking of properties
|
||||
// that have already been assigned to, as these are not actually pushed into the resulting type
|
||||
if (!nameTable[prop.name]) {
|
||||
if (!hasProperty(nameTable, prop.name)) {
|
||||
const targetPropSym = getPropertyOfType(elementAttributesType, prop.name);
|
||||
if (targetPropSym) {
|
||||
const msg = chainDiagnosticMessages(undefined, Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property, prop.name);
|
||||
@@ -10406,7 +10406,7 @@ namespace ts {
|
||||
const targetProperties = getPropertiesOfType(targetAttributesType);
|
||||
for (let i = 0; i < targetProperties.length; i++) {
|
||||
if (!(targetProperties[i].flags & SymbolFlags.Optional) &&
|
||||
nameTable[targetProperties[i].name] === undefined) {
|
||||
!hasProperty(nameTable, targetProperties[i].name)) {
|
||||
|
||||
error(node, Diagnostics.Property_0_is_missing_in_type_1, targetProperties[i].name, typeToString(targetAttributesType));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user