tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(9,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(17,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(23,13): error TS2331: 'this' cannot be referenced in a module or namespace body.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(31,13): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(33,25): error TS2507: Type 'undefined' is not a constructor function type.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(39,9): error TS2332: 'this' cannot be referenced in current location.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(40,9): error TS2332: 'this' cannot be referenced in current location.


==== tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts (7 errors) ====
    class BaseErrClass {
        constructor(t: any) { }
    }
    
    class ClassWithNoInitializer extends BaseErrClass {
        t;
        //'this' in optional super call
        constructor() {
            super(this); // error: "super" has to be called before "this" accessing
                  ~~~~
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
        }
    }
    
    class ClassWithInitializer extends BaseErrClass {
        t = 4;
        //'this' in required super call
        constructor() {
            super(this); // Error
                  ~~~~
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
        }
    }
    
    module M {
        //'this' in module variable
        var x = this; // Error
                ~~~~
!!! error TS2331: 'this' cannot be referenced in a module or namespace body.
    }
    
    //'this' as type parameter constraint
    // function fn<T extends this >() { } // Error
    
    //'this' as a type argument
    function genericFunc<T>(x: T) { }
    genericFunc<this>(undefined);  // Should be an error
                ~~~~
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
    
    class ErrClass3 extends this {
                            ~~~~
!!! error TS2507: Type 'undefined' is not a constructor function type.
    
    }
    
    //'this' as a computed enum value
    enum SomeEnum {
        A = this, // Should not be allowed
            ~~~~
!!! error TS2332: 'this' cannot be referenced in current location.
        B = this.spaaaace // Also should not be allowed
            ~~~~
!!! error TS2332: 'this' cannot be referenced in current location.
    }
    
    export = this; // Should be an error