Skip to content

Commit 699ea24

Browse files
author
Andy
authored
Skip arrow functions in checkAndReportErrorForMissingPrefix (microsoft#23584)
1 parent 5c94bef commit 699ea24

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1568,7 +1568,7 @@ namespace ts {
15681568
return false;
15691569
}
15701570

1571-
const container = getThisContainer(errorLocation, /*includeArrowFunctions*/ true);
1571+
const container = getThisContainer(errorLocation, /*includeArrowFunctions*/ false);
15721572
let location = container;
15731573
while (location) {
15741574
if (isClassLike(location.parent)) {

tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error TS2304: Cannot find name 'field1'.
1+
tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error TS2663: Cannot find name 'field1'. Did you mean the instance member 'this.field1'?
22

33

44
==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts (0 errors) ====
@@ -14,6 +14,6 @@ tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error T
1414
messageHandler = () => {
1515
console.log(field1); // Should be error that couldnt find symbol field1
1616
~~~~~~
17-
!!! error TS2304: Cannot find name 'field1'.
17+
!!! error TS2663: Cannot find name 'field1'. Did you mean the instance member 'this.field1'?
1818
};
1919
}

0 commit comments

Comments
 (0)