ref(utils): simplify useDimensions types by removing type parameter#112460
ref(utils): simplify useDimensions types by removing type parameter#112460JoshuaKGoldberg merged 2 commits intomasterfrom
Conversation
natemoo-re
left a comment
There was a problem hiding this comment.
I tend to default to an options bag to make refactoring easier, but we still have a second param to use for any future options here. Nice refactor!
|
The RTL hook helpers work better with an options bag, they can track types better. In the past we've made everything use options objects like this to make refactors easier and to simplify so cases like that RTL example are not special but more of a default. |
|
Ok I'll go ahead and put back the options object. 👍 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b34d1b0. Configure here.
…112460) Following up on #112374, I noted two things that could be simplified with `useDimensions`: * ~Runtime: it takes in an options object, but there's only one property. This means every call creates a new JS object. This is a little papercut for performance (almost certainly not impactful on its own, but they add up).~ This is intentional and preferred; reverted. * Types: its type parameter is unnecessary, and only bypasses [`@typescript-eslint/no-unnecessary-type-parameters`](https://typescript-eslint.io/rules/no-unnecessary-type-parameters) because it forwards the type parameter to `RefObject` (https://typescript-eslint.io/rules/no-unnecessary-type-parameters/#limitations)

Following up on #112374, I noted two things that could be simplified with
useDimensions:Runtime: it takes in an options object, but there's only one property. This means every call creates a new JS object. This is a little papercut for performance (almost certainly not impactful on its own, but they add up).This is intentional and preferred; reverted.@typescript-eslint/no-unnecessary-type-parametersbecause it forwards the type parameter toRefObject(https://typescript-eslint.io/rules/no-unnecessary-type-parameters/#limitations)