diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c1cb7166015..f0d13cacf51 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1568,7 +1568,7 @@ namespace ts { return false; } - const container = getThisContainer(errorLocation, /*includeArrowFunctions*/ true); + const container = getThisContainer(errorLocation, /*includeArrowFunctions*/ false); let location = container; while (location) { if (isClassLike(location.parent)) { diff --git a/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt b/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt index 58a660c1ee8..03aa27e91f8 100644 --- a/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt +++ b/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error TS2304: Cannot find name 'field1'. +tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error TS2663: Cannot find name 'field1'. Did you mean the instance member 'this.field1'? ==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts (0 errors) ==== @@ -14,6 +14,6 @@ tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error T messageHandler = () => { console.log(field1); // Should be error that couldnt find symbol field1 ~~~~~~ -!!! error TS2304: Cannot find name 'field1'. +!!! error TS2663: Cannot find name 'field1'. Did you mean the instance member 'this.field1'? }; } \ No newline at end of file