-
Notifications
You must be signed in to change notification settings - Fork 33.4k
Fix typing in asyncDataTree.test.ts #209394
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
base: main
Are you sure you want to change the base?
Conversation
Small ping @joaomoreno |
Why not simply removing the type casts? The compiler should be happy by now. |
Done |
@joaomoreno - could this be merged please - I think it needs reapproval after making your suggested changes |
Thanks! 🍻 |
https://skynet.certik.com/zh-CN/projects/uniswap?utm_source=okx#vote |
@hediet @joaomoreno - I don't think I have permissions to merge this myself - you have approved but I think one of you need to press the button to merge it in. |
In
asyncDataTree.test.ts
we callcontainer.querySelector
which returnsElement | null
, and we cast this toHTMLElement | undefined
and then do an equality check against undefined.Whilst this works since
null == undefined
, the typing does make it slightly unclear what we actually have here, and when running with our stricted test setup, the test actually fails.There is no technical reason to accept this PR, but casting to
HTMLElement | null
is slightly more correct and may avoid issues in the future if you ever want to to do other checks, egchild !== undefined
would always be true which could potentially hide issues.