Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript should support defineProperty assignments to exports #22439

Closed
sandersn opened this issue Mar 9, 2018 · 4 comments
Closed

Javascript should support defineProperty assignments to exports #22439

sandersn opened this issue Mar 9, 2018 · 4 comments
Assignees
Labels
Fixed A PR has been merged for this issue

Comments

@sandersn
Copy link
Member

sandersn commented Mar 9, 2018

// @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

@sandersn sandersn added Bug A bug in TypeScript Salsa labels Mar 9, 2018
@mhegazy mhegazy added Suggestion An idea for TypeScript and removed Bug A bug in TypeScript labels Mar 9, 2018
@mhegazy
Copy link
Contributor

mhegazy commented Mar 9, 2018

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

@hpmax00
Copy link

hpmax00 commented Sep 12, 2018

@mhegazy In the fruture, can you support this?

@sandersn
Copy link
Member Author

@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.

@weswigham weswigham self-assigned this Nov 6, 2018
@weswigham weswigham added Fixed A PR has been merged for this issue and removed Suggestion An idea for TypeScript labels Nov 6, 2018
@weswigham
Copy link
Member

weswigham commented Nov 6, 2018

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
Labels
Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants