Skip to content

If map.has() returns true than map.get should not be possibly undefined #30268

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
isidorn opened this issue Mar 8, 2019 · 2 comments
Closed

Comments

@isidorn
Copy link

isidorn commented Mar 8, 2019

Typescript 3.3
Strict null checking turned on

if (map.has(key)) {
 map.get(key).attr   -> TS complains this might be null
}

TS shuold somehow undertsand that the key is in the map (which as value does not have undefined elements).

I searched for duplicates and could not find any.

@jack-williams
Copy link
Collaborator

Duplicate of #9619

@isidorn
Copy link
Author

isidorn commented Mar 11, 2019

Yeah, it is a duplicate, closing. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants