Skip arrow functions in checkAndReportErrorForMissingPrefix (#23584)

This commit is contained in:
Andy 2018-04-20 15:02:18 -07:00 committed by GitHub
parent 5c94bef0e1
commit 699ea246ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -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)) {

View File

@ -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'?
};
}