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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

This condition will always return 'false' since the types 'string | null' and 'number' have no overlap.deno-ts(2367) #50388

Closed
BlackAsLight opened this issue Aug 21, 2022 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@BlackAsLight
Copy link

Bug Report

馃捇 Code

const nationID = 19818
if (localStorage.getItem("id") == nationID) {
    // do something
}

馃檨 Actual behavior

Typescript incorrectly complains saying that there is no overlap here between a string | null and a number. If I was using three equal symbols then I would agree with it, but I鈥檓 not because I want it to do the conversion for me. "4" == 4 returns true while "4" === 4 returns false. It is wrong for typescript to treat a double equal symbol and triple equal symbol as the same.

馃檪 Expected behavior

Typescript to not not complain about something that isn鈥檛 true.

@MartinJohns
Copy link
Contributor

Duplicate of #26592.

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Aug 25, 2022
@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.

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

4 participants