Skip to content

In JS, module.exports should support property assignments as declaration #22459

@sandersn

Description

@sandersn
// @noEmit: true
// @allowJs: true
// @checkJs: true
// @strict: true
// @Filename: a.js

// from debug
var debug = module.exports = create.debug = create['default'] = create;
function create() {
    function d() {
        var curr = +new Date()
        d.curr = curr
    }
    return d
}
function assert() {
}
debug.assert = assert

Expected behavior:
No errors, and the debug module should have exports { debug, default, assert } and also be callable.

Actual behavior:
Lots of different errors, and no exported members. Moving the function create before the exports assignments adds the export debug, but that's it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: JavaScriptThe issue relates to JavaScript specificallycheckJsRelates to checking JavaScript using TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions