Skip to content

[Errors] _this in reserved positions #64

Closed
@mhegazy

Description

@mhegazy
//==== tests/cases/compiler/collisionThisExpressionAndAliasInGlobal.ts (1 errors) ====
module a {
   export var b = 10;
}
var f = () => this;
import _this = a; // Error
//!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.

Expected: errors as above
Actual: no errors

Similar but different error:

//==== tests/cases/compiler/collisionThisExpressionAndAmbientClassInGlobal.ts (1 errors) ====
declare class _this { // no error - as no code generation
}
var f = () => this;
var a = new _this(); // Error
//!!! Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions