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

Fix instanceof check #231

Merged
merged 1 commit into from
Jan 29, 2024
Merged

Fix instanceof check #231

merged 1 commit into from
Jan 29, 2024

Conversation

patdx
Copy link
Contributor

@patdx patdx commented Jan 26, 2024

I think there is an issue in the instanceof check.

I keep getting an warning message like this in my bundler where imported this library:

▲ [WARNING] Suspicious use of the "!" operator inside the "instanceof" operator [suspicious-boolean-not]
    .wrangler/tmp/pages-GVXi9w/bundledWorker-0.2874780651986786.mjs:31392:16:
      31392 │             if (!inputRef.current instanceof HTMLInputElement)
            │                 ~~~~~~~~~~~~~~~~~
            ╵                 (!inputRef.current)

Right now !inputRef.current is evaluated first to either true or false, and true instanceof HTMLInputElement and false instanceof HTMLInputElement would both evaluate to false, so I think this code will not trigger at all at the moment.

For extra confirmation I tried plugging it into ASTExplorer which also showed that !inputRef.current is evaluated as one unit:

image

I just created this PR in the GitHub web interface, not sure if that will suffice to be ready to merge. Let me know if you'd need anything from me. Thanks!

@patdx patdx marked this pull request as ready for review January 26, 2024 07:48
@ErrorPro ErrorPro merged commit abe3fa3 into ErrorPro:master Jan 29, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants