mod1.js(7,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
mod2.js(7,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
mod3.js(7,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.


==== commonjs.d.ts (0 errors) ====
    declare var module: { exports: any};
==== mod1.js (1 errors) ====
    /// <reference path="./commonjs.d.ts"/>
    /** @typedef {{ type: "a", x: 1 }} A */
    /** @typedef {{ type: "b", y: 1 }} B */
    /** @typedef {A | B} Both */
    module.exports = C
    function C() {
        this.p = 1
        ~~~~
!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
    }
    
==== mod2.js (1 errors) ====
    /// <reference path="./commonjs.d.ts"/>
    /** @typedef {{ type: "a", x: 1 }} A */
    /** @typedef {{ type: "b", y: 1 }} B */
    /** @typedef {A | B} Both */
    
    export function C() {
        this.p = 1
        ~~~~
!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
!!! related TS2738 mod2.js:6:17: An outer value of 'this' is shadowed by this container.
    }
    
==== mod3.js (1 errors) ====
    /// <reference path="./commonjs.d.ts"/>
    /** @typedef {{ type: "a", x: 1 }} A */
    /** @typedef {{ type: "b", y: 1 }} B */
    /** @typedef {A | B} Both */
    
    exports.C = function() {
        this.p = 1
        ~~~~
!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
    }
    
==== use.js (0 errors) ====
    /** @type {import('./mod1').Both} */
    var both1 = { type: 'a', x: 1 };
    /** @type {import('./mod2').Both} */
    var both2 = both1;
    /** @type {import('./mod3').Both} */
    var both3 = both2;
    
    
    