Skip to content

Commit 1cad8ed

Browse files
author
Nathan Fenner
committed
check for SyntaxKind.JSXAttribute instead of located-ness of name prop
1 parent dbc1722 commit 1cad8ed

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/compiler/checker.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13040,9 +13040,9 @@ namespace ts {
1304013040
// JsxAttributes has an object-literal flag and undergo same type-assignablity check as normal object-literal.
1304113041
// However, using an object-literal error message will be very confusing to the users so we give different a message.
1304213042
// TODO: Spelling suggestions for excess jsx attributes (needs new diagnostic messages)
13043-
if (prop.valueDeclaration && isNamedDeclaration(prop.valueDeclaration) && prop.valueDeclaration.name && prop.valueDeclaration.name.pos !== -1) {
13044-
// If the "children" attribute is extraneous `<NoChild>extra</NoChild>` then the declaration's name has no location.
13045-
// In that case, do not update the error location, since there's no name to point to.
13043+
if (prop.valueDeclaration && isJsxAttribute(prop.valueDeclaration)) {
13044+
// Note that extraneous children (as in `<NoChild>extra</NoChild>`) don't pass this check,
13045+
// since `children` is a SyntaxKind.PropertySignature instead of a SyntaxKind.JsxAttribute.
1304613046
errorNode = prop.valueDeclaration.name;
1304713047
}
1304813048
reportError(Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(prop), typeToString(errorTarget));

0 commit comments

Comments
 (0)