Skip to content

Commit 8c27075

Browse files
authored
In plain JS files, only suggestion did-you-mean errors (#46151)
They will have code fixes, and are tuned for high precision. Others are not.
1 parent fbff131 commit 8c27075

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28454,7 +28454,7 @@ namespace ts {
2845428454
if (relatedInfo) {
2845528455
addRelatedInfo(resultDiagnostic, relatedInfo);
2845628456
}
28457-
addErrorOrSuggestion(!isUncheckedJS, resultDiagnostic);
28457+
addErrorOrSuggestion(!isUncheckedJS || errorInfo.code !== Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, resultDiagnostic);
2845828458
}
2845928459

2846028460
function containerSeemsToBeEmptyDomElement(containingType: Type) {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @allowjs: true
4+
// @noEmit: true
5+
6+
// @filename: noSuggestionWithoutDidYouMean.js
7+
//// let a = {};
8+
//// console.log(a.apple);
9+
verify.noErrors()
10+
verify.getSuggestionDiagnostics([])

0 commit comments

Comments
 (0)