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

🐛 Bug: isFalsyType should return true for 0n #544

Closed
3 tasks done
kirkwaiblinger opened this issue Oct 27, 2024 · 0 comments · Fixed by #545
Closed
3 tasks done

🐛 Bug: isFalsyType should return true for 0n #544

kirkwaiblinger opened this issue Oct 27, 2024 · 0 comments · Fixed by #545
Labels
status: accepting prs Please, send a pull request to resolve this! 🙏 type: bug Something isn't working :( 🐛

Comments

@kirkwaiblinger
Copy link
Contributor

Bug Report Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and found none that matched my issue.

Expected

given the literal 0n type, isFalsyType(type) should be true.

Actual

isFalsyType(type) is false.

Additional Info

This is because the ts api returns a PseudoBigInt object (rather than a bigint primitive) which is always truthy, causing this check to be incorrect:

if (type.isLiteral()) {
return !type.value;
}

See also https://github.com/typescript-eslint/typescript-eslint/pull/10205/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepting prs Please, send a pull request to resolve this! 🙏 type: bug Something isn't working :( 🐛
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants