Skip to content

Derive tuple element's type accessed by const enum index #4052

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
lazdmx opened this issue Jul 28, 2015 · 1 comment
Closed

Derive tuple element's type accessed by const enum index #4052

lazdmx opened this issue Jul 28, 2015 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@lazdmx
Copy link

lazdmx commented Jul 28, 2015

It would be handy if TS will use values of const enum literals when deriving element type.

type T = [number, string]
const enum Idx {
    Num, Str
}
var t: T = [0, '1']
var x = t.shift()
var y = t[Idx.Num] // expect number type but got string | number
var z = t[Idx.Str] // expect string type but got string | number
@RyanCavanaugh
Copy link
Member

Dupe #3411

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Jul 28, 2015
@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

2 participants