File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -16098,7 +16098,10 @@ namespace ts {
16098
16098
const isPerformingExcessPropertyChecks = !(intersectionState & IntersectionState.Target) && (isObjectLiteralType(source) && getObjectFlags(source) & ObjectFlags.FreshLiteral);
16099
16099
if (isPerformingExcessPropertyChecks) {
16100
16100
if (hasExcessProperties(<FreshObjectLiteralType>source, target, reportErrors)) {
16101
- if (reportErrors) {
16101
+ // Skip report relation error if there is diag with suggestion emitted
16102
+ // So the fixSpelling can work with JSX attribute suggestion
16103
+ const skipReport = isComparingJsxAttributes && errorInfo?.code === Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code;
16104
+ if (reportErrors && !skipReport) {
16102
16105
reportRelationError(headMessage, source, target);
16103
16106
}
16104
16107
return Ternary.False;
Original file line number Diff line number Diff line change @@ -52,6 +52,12 @@ namespace ts.codefix {
52
52
suggestedSymbol = checker . getSuggestedSymbolForNonexistentModule ( node , resolvedSourceFile . symbol ) ;
53
53
}
54
54
}
55
+ else if ( isJsxAttribute ( parent ) && parent . name === node ) {
56
+ Debug . assertNode ( node , isIdentifier , "Expected an identifier for JSX attribute" ) ;
57
+ const tag = findAncestor ( node , isJsxOpeningLikeElement ) ! ;
58
+ const props = checker . getContextualTypeForArgumentAtIndex ( tag , 0 ) ;
59
+ suggestedSymbol = checker . getSuggestedSymbolForNonexistentProperty ( node , props ! ) ;
60
+ }
55
61
else {
56
62
const meaning = getMeaningFromLocation ( node ) ;
57
63
const name = getTextOfNode ( node ) ;
You can’t perform that action at this time.
0 commit comments