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

Dynamic function typings based on string params passed #10660

Closed
wclr opened this issue Sep 1, 2016 · 3 comments
Closed

Dynamic function typings based on string params passed #10660

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

Comments

@wclr
Copy link

wclr commented Sep 1, 2016

Probably this is an issue of dynamic typing, didn't find exact here in the issues (probably you will point to).

Is it possible to do typing and achieve types flow of such thing:

function getProp(prop: string, obj: any) {
  return obj[prop]
}  

let obj: { id: number } = { id: 1 }

getProp('id', obj). // there should flow number type
@gcnew
Copy link
Contributor

gcnew commented Sep 1, 2016

Rumor has it that it was once considered in a distant whimsical land, where unicorns walk freely under rainbows and mighty wombats support the sky. It is, however, deemed intractable for the feeble human beings.

Use #1295 as a starting point, see #10425.

@wclr
Copy link
Author

wclr commented Sep 1, 2016

@gcnew thanks for pointing on that

@mhegazy
Copy link
Contributor

mhegazy commented Sep 2, 2016

indeed duplicate.

@mhegazy mhegazy closed this as completed Sep 2, 2016
@mhegazy mhegazy added the Duplicate An existing issue was already created label Sep 2, 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