Skip to content

Javascript should support defineProperty assignments to exports #22439

Closed

Description

// @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: defaults.js
exports.Umask = Umask
function Umask() {}
Object.defineProperty(exports, 'defaults', {
    get: function() {
        return 1
    }
})

// @Filename: use.js
var def = require('./defaults').defaults
var one = def

Expected behavior:
defaults is bound
Actual behavior:
defaults is not bound

Activity

  1. mhegazy commented on Mar 9, 2018

    @mhegazy
    Contributor

    Looks like the same issue as #6651. In the past we have chose not to support such patterns, in general.

  2. hpmax00 commented on Sep 12, 2018

    @hpmax00

    Mohamed Hegazy (@mhegazy) In the fruture, can you support this?

  3. sandersn commented on Sep 12, 2018

    @sandersn
    MemberAuthor

    hpmax00 We decide which patterns to support by the amount of usage we observe in popular code bases, plus upvotes on this issue. Right now I haven't seen many of either, but that might change in the future.

  4. added
    FixedA PR has been merged for this issue
    and removed
    SuggestionAn idea for TypeScript
    on Nov 6, 2018
  5. weswigham commented on Nov 6, 2018

    @weswigham
    Member

    We should support this in 3.2 thanks to #27208.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

FixedA PR has been merged for this issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions