mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 10:46:28 -05:00
Merge pull request #33477 from Nathan-Fenner/error-on-extra-jsx-prop
report error on extraneous JSX prop instead of element name
This commit is contained in:
@@ -13041,6 +13041,11 @@ namespace ts {
|
||||
// JsxAttributes has an object-literal flag and undergo same type-assignablity check as normal object-literal.
|
||||
// However, using an object-literal error message will be very confusing to the users so we give different a message.
|
||||
// TODO: Spelling suggestions for excess jsx attributes (needs new diagnostic messages)
|
||||
if (prop.valueDeclaration && isJsxAttribute(prop.valueDeclaration)) {
|
||||
// Note that extraneous children (as in `<NoChild>extra</NoChild>`) don't pass this check,
|
||||
// since `children` is a SyntaxKind.PropertySignature instead of a SyntaxKind.JsxAttribute.
|
||||
errorNode = prop.valueDeclaration.name;
|
||||
}
|
||||
reportError(Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(prop), typeToString(errorTarget));
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user