Skip to content

Get object property by typed value #10951

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

Closed
wclr opened this issue Sep 16, 2016 · 1 comment
Closed

Get object property by typed value #10951

wclr opened this issue Sep 16, 2016 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@wclr
Copy link

wclr commented Sep 16, 2016

This currenlty doen't work:

let person: { name: string, age: number } = {
  name: 'John', age: 10
} 
type NameOrAge = 'name' | 'age'
let prop: NameOrAge = 'name'

let nameOrAge = person[prop] // `nameOrAge`  would take tape of `string | number`

image

Is it going to work in near future?

@RyanCavanaugh
Copy link
Member

I think this is covered by #6080

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Sep 16, 2016
@mhegazy mhegazy closed this as completed Sep 16, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants