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

IndexedAccess still drops index signature on ReadonlyArray #31149

Closed
ajafff opened this issue Apr 28, 2019 · 0 comments · Fixed by #31150
Closed

IndexedAccess still drops index signature on ReadonlyArray #31149

ajafff opened this issue Apr 28, 2019 · 0 comments · Fixed by #31150
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@ajafff
Copy link
Contributor

ajafff commented Apr 28, 2019

TypeScript Version: 3.5.0-dev.20190427

Follow-up on #30938 @ahejlsberg

Code

function fn<T extends ReadonlyArray<string>>(param: T, cb: (element: T[number]) => void) {
    cb(param[0]); // Argument of type 'string' is not assignable to parameter of type 'T[number]'.
}

Expected behavior:
Works with Array<string> and ReadonlyArray<string>.

Actual behavior:
Fails with ReadonlyArray.

Related Issues:
#30938
#31000

@ahejlsberg ahejlsberg self-assigned this Apr 28, 2019
@ahejlsberg ahejlsberg added the Bug A bug in TypeScript label Apr 28, 2019
@ahejlsberg ahejlsberg added this to the TypeScript 3.5.0 milestone Apr 28, 2019
@ahejlsberg ahejlsberg added the Fixed A PR has been merged for this issue label Apr 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants