Skip to content

In JS, any declaration with a non-primitive initializer should be a JS container #22637

Closed
@sandersn

Description

@sandersn
// @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: a.js
// from clear-require
var clear = moduleId => 2
clear.all = () => 1

Expected behavior:
all is a property on clear, and has the type () => number.

Actual behavior:
Error: 'all' is not a property on 'clear'.

Maybe any top-level declaration with a non-primitive initialiser should create a container in Javascript, although that would be hard to verify in the binder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions