26 lines
884 B
Plaintext
26 lines
884 B
Plaintext
==== tests/cases/compiler/collisionThisExpressionAndLocalVarInConstructor.ts (2 errors) ====
|
|
class class1 {
|
|
constructor() {
|
|
var x2 = {
|
|
doStuff: (callback) => () => {
|
|
var _this = 2;
|
|
~~~~~
|
|
!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.
|
|
return callback(this);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
class class2 {
|
|
constructor() {
|
|
var _this = 2;
|
|
~~~~~
|
|
!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.
|
|
var x2 = {
|
|
doStuff: (callback) => () => {
|
|
return callback(this);
|
|
}
|
|
}
|
|
}
|
|
} |