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

Cannot access indexed type of constrained type parameter #12340

Closed
HerringtonDarkholme opened this issue Nov 18, 2016 · 1 comment
Closed

Cannot access indexed type of constrained type parameter #12340

HerringtonDarkholme opened this issue Nov 18, 2016 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@HerringtonDarkholme
Copy link
Contributor

Related: #12311

TypeScript Version: nightly
Code

type Boxed = {
    [k in string]: {value: any}
}

type Unboxed<T extends Boxed> = {
    [K in keyof T]: T[K]['value']
}

Expected behavior:
Should compile since Boxed has index signature. T with constraint Boxed should also be indexable, with T[K] constrained by Boxed's value type, in this case, {value: any}

Actual behavior:

Error, Property 'value' does not exist on type 'T[K]'

@ahejlsberg
Copy link
Member

ahejlsberg commented Nov 18, 2016

Duplicate of #12311. Fixed by #12351.

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