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

array.map lose literal types #26999

Closed
cevek opened this issue Sep 10, 2018 · 6 comments
Closed

array.map lose literal types #26999

cevek opened this issue Sep 10, 2018 · 6 comments
Labels
Duplicate An existing issue was already created

Comments

@cevek
Copy link

cevek commented Sep 10, 2018

TypeScript Version: 3.1.0-dev.20180906

Search Terms:

Code

interface Item {
    x: number;
    y: 'a' | 'b'
}
var list:Item[] = [].map(it => ({x: 1, y: 'a'}))

Expected behavior:
No error

Actual behavior:
Type 'string' is not assignable to type '"a" | "b"'.

@RyanCavanaugh
Copy link
Member

Root cause is #241

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Sep 10, 2018
@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@thw0rted
Copy link

thw0rted commented Sep 9, 2020

This will be fixed by #40311, see the comment I just left on #33158.

@DanielRosenwasser
Copy link
Member

It won't be fixed by #40311 unfortunately (see the "Future Work" section in the PR writeup)

@thw0rted
Copy link

Well crud. This is all my fault, I had a bunch of related tabs open and posted this comment in a few of them where I thought the issue being reported was the same -- this wasn't one of them. Sorry!

@DanielRosenwasser
Copy link
Member

Don't sweat it, I had the same enthusiasm at first. 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

5 participants