diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7357c63578852..e3efdf4d237c4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -31683,10 +31683,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (file) { if (compilerOptions.checkJs === undefined && file.checkJsDirective === undefined && (file.scriptKind === ScriptKind.JS || file.scriptKind === ScriptKind.JSX)) { const declarationFile = forEach(suggestion?.declarations, getSourceFileOfNode); - const suggestionHasNoExtends = !suggestion?.valueDeclaration || !isClassLike(suggestion.valueDeclaration) || suggestion.valueDeclaration.heritageClauses?.length + const suggestionHasNoExtendsOrDecorators = !suggestion?.valueDeclaration + || !isClassLike(suggestion.valueDeclaration) + || suggestion.valueDeclaration.heritageClauses?.length + || classOrConstructorParameterIsDecorated(/*useLegacyDecorators*/ false, suggestion.valueDeclaration); return !(file !== declarationFile && !!declarationFile && isGlobalSourceFile(declarationFile)) - && !(excludeClasses && suggestion && suggestion.flags & SymbolFlags.Class && suggestionHasNoExtends) - && !(!!node && excludeClasses && isPropertyAccessExpression(node) && node.expression.kind === SyntaxKind.ThisKeyword && suggestionHasNoExtends); + && !(excludeClasses && suggestion && suggestion.flags & SymbolFlags.Class && suggestionHasNoExtendsOrDecorators) + && !(!!node && excludeClasses && isPropertyAccessExpression(node) && node.expression.kind === SyntaxKind.ThisKeyword && suggestionHasNoExtendsOrDecorators); } } return false; diff --git a/tests/cases/fourslash/codeFixSpellingJs9.ts b/tests/cases/fourslash/codeFixSpellingJs9.ts index bbdc16d99d643..876d31caefac2 100644 --- a/tests/cases/fourslash/codeFixSpellingJs9.ts +++ b/tests/cases/fourslash/codeFixSpellingJs9.ts @@ -23,6 +23,17 @@ //// const person = new Person(); //// person.[|getFavoriteColour|](); //// person.[|getFavoriteColoxr|](); +//// function deco() { } +//// @deco +//// class Art { +//// style = true +//// } +//// const a = new Art() +//// a.[|stylo|] +//// @deco +//// class Double extends Art { } +//// const db = new Double() +//// db.[|stylo|] verify.codeFixAll({ fixId: "fixSpelling", fixAllDescription: "Fix all detected spelling errors", @@ -48,5 +59,16 @@ class Person { const person = new Person(); person.getFavoriteColor(); -person.getFavoriteColor();`, +person.getFavoriteColor(); +function deco() { } +@deco +class Art { + style = true +} +const a = new Art() +a.stylo +@deco +class Double extends Art { } +const db = new Double() +db.stylo`, });