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

No error with === undefined (or null) against a type that doesn't contain undefined (2367) #37160

Closed
Retsam opened this issue Mar 2, 2020 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@Retsam
Copy link

Retsam commented Mar 2, 2020

TypeScript Version: Version 3.9.0-dev.20200229

Search Terms: 2367, no overlap,

Code

if("str" === undefined) { /* ... */ }

Expected behavior:
Expected error (with strictNullChecks on): This condition will always return 'false' since the types 'string' and 'undefined' have no overlap

Actual behavior:
No error

Playground Link: https://www.typescriptlang.org/play/?ssl=1&ssc=1&pln=1&pc=40#code/JYMwBAFARALgpgZxlMBedYCuA7AJnEYbOXASjAG8wB6AKjADomxbqwBfIA

Related Issues:
#32627
typescript-eslint#1591

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Mar 2, 2020
@Retsam
Copy link
Author

Retsam commented Mar 2, 2020

@RyanCavanaugh Marked as duplicate, can you link the issue that this duplicates? I couldn't find anything more similar than #32627. Thanks!

@RyanCavanaugh
Copy link
Member

#30519, #11920

@Retsam
Copy link
Author

Retsam commented Mar 2, 2020

Thanks, sorry I missed those.

@Retsam Retsam closed this as completed Mar 2, 2020
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

2 participants