diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index 0599eb4bbbc60..84d5cd08a2bb1 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -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));
}
diff --git a/tests/baselines/reference/tsxAttributeResolution5.errors.txt b/tests/baselines/reference/tsxAttributeResolution5.errors.txt
index d7aa46bc05ace..42dabc741ab92 100644
--- a/tests/baselines/reference/tsxAttributeResolution5.errors.txt
+++ b/tests/baselines/reference/tsxAttributeResolution5.errors.txt
@@ -2,9 +2,10 @@ tests/cases/conformance/jsx/file.tsx(21,16): error TS2606: Property 'x' of JSX s
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsx/file.tsx(25,9): error TS2324: Property 'x' is missing in type 'Attribs1'.
tests/cases/conformance/jsx/file.tsx(29,1): error TS2324: Property 'x' is missing in type 'Attribs1'.
+tests/cases/conformance/jsx/file.tsx(30,1): error TS2324: Property 'toString' is missing in type 'Attribs2'.
-==== tests/cases/conformance/jsx/file.tsx (3 errors) ====
+==== tests/cases/conformance/jsx/file.tsx (4 errors) ====
declare module JSX {
interface Element { }
interface IntrinsicElements {
@@ -41,5 +42,7 @@ tests/cases/conformance/jsx/file.tsx(29,1): error TS2324: Property 'x' is missin
; // Error, missing x
~~~~~~~~~~~~~~~~~
!!! error TS2324: Property 'x' is missing in type 'Attribs1'.
- ; // OK
+ ; // Error, missing toString
+ ~~~~~~~~~~~~~~~~~
+!!! error TS2324: Property 'toString' is missing in type 'Attribs2'.
\ No newline at end of file
diff --git a/tests/baselines/reference/tsxAttributeResolution5.js b/tests/baselines/reference/tsxAttributeResolution5.js
index abfb54e000c7e..4bde09074b552 100644
--- a/tests/baselines/reference/tsxAttributeResolution5.js
+++ b/tests/baselines/reference/tsxAttributeResolution5.js
@@ -28,7 +28,7 @@ function make3 (obj: T) {
; // Error, missing x
-; // OK
+; // Error, missing toString
//// [file.jsx]
@@ -42,4 +42,4 @@ function make3(obj) {
return ; // Error, missing x
}
; // Error, missing x
-; // OK
+; // Error, missing toString
diff --git a/tests/cases/conformance/jsx/tsxAttributeResolution5.tsx b/tests/cases/conformance/jsx/tsxAttributeResolution5.tsx
index dd16ade10e31e..83fb7b32f5620 100644
--- a/tests/cases/conformance/jsx/tsxAttributeResolution5.tsx
+++ b/tests/cases/conformance/jsx/tsxAttributeResolution5.tsx
@@ -29,4 +29,4 @@ function make3 (obj: T) {
; // Error, missing x
-; // OK
+; // Error, missing toString