Don't allow properties inherited from Object to be automatically included in TSX attributes

This commit is contained in:
Andy Hanson
2016-08-04 14:13:07 -07:00
parent 18fb33d36f
commit 9947ac2ece
4 changed files with 10 additions and 7 deletions

View File

@@ -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));
}