Skip to content

Javascript should support property assignments on exports, even when aliased #22436

Description

// @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: semver.js
exports = module.exports = C
exports.f = n => n + 1
function C() {
    this.p = 1
}
// @filename: index.js
const C = require("./semver")
var two = C.f(1)
var c = new C

Expected behavior:
In index.js, f should be a member of C.

Actual behavior:
It is not.

Note that if you assign to C, f is visible, but only if the assignment occurs after function C () { ... }. But that's a separate bug.

Metadata

Metadata

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issuecheckJsRelates to checking JavaScript using TypeScript

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions