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

Object literals computed property names allow literal-typed expressions #18317

Merged
merged 2 commits into from
Sep 7, 2017

Conversation

sandersn
Copy link
Member

@sandersn sandersn commented Sep 7, 2017

This is a late-stage name replacement in checkObjectLiteral, so it's a special-case of Ron's upcoming dynamic names change.

Fixes #16687

@mthurlin
Copy link

With this change, will the following be supported?

function makeFooOrBar(key: "foo" | "bar"): {foo: number} | {bar: number} {
    return {[key]: 4711}; // Currently an error, as "key" is widened to string
}

@mhegazy
Copy link
Contributor

mhegazy commented Nov 13, 2017

@mthurlin that is tracked by #13948

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants