diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index fbfbfc9b3d6..3d54f2e9db5 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -28454,7 +28454,7 @@ namespace ts { if (relatedInfo) { addRelatedInfo(resultDiagnostic, relatedInfo); } - addErrorOrSuggestion(!isUncheckedJS, resultDiagnostic); + addErrorOrSuggestion(!isUncheckedJS || errorInfo.code !== Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, resultDiagnostic); } function containerSeemsToBeEmptyDomElement(containingType: Type) { diff --git a/tests/cases/fourslash/codeFixSpellingJs9.ts b/tests/cases/fourslash/codeFixSpellingJs9.ts new file mode 100644 index 00000000000..74d78c827c2 --- /dev/null +++ b/tests/cases/fourslash/codeFixSpellingJs9.ts @@ -0,0 +1,10 @@ +/// + +// @allowjs: true +// @noEmit: true + +// @filename: noSuggestionWithoutDidYouMean.js +//// let a = {}; +//// console.log(a.apple); +verify.noErrors() +verify.getSuggestionDiagnostics([])