allow to specify the type of `ref` returned by `useFocusable`
- Originally, I've tried
E extends HTMLElement = HTMLElement, but that made the new type arg effectively required because ofType 'RefObject<HTMLElement>' is not assignable to type 'Ref<HTMLDivElement>'. -
src/App.tsxshould passes type check without changes in this PR, but adding the new type arg seemed like a correct thing to do in the example
Hi, thank you for the PR.
I’m wondering whether this change is actually necessary or if it’s solving a real issue.
My main concern with the proposed approach is that it doesn’t support react-native, where HTMLElements aren’t available at all.
I’m wondering whether this change is actually necessary or if it’s solving a real issue.
We’re trying to eliminate as much any from our code base as possible, and using a type arg seems like a clean way of doing that from the caller side
My main concern with the proposed approach is that it doesn’t support react-native, where HTMLElements aren’t available at all.
Riiight. Removing extends HTMLElement would solve that concern, wouldn’t it?
(I don’t know if there’s an another approach of typing things like that in a way that would work in both react-dom and react-native)
Riiight. Removing extends HTMLElement would solve that concern, wouldn’t it?
Yep. Just adding the generic type and defaulting it to any should do the trick for you
Yep. Just adding the generic type and defaulting it to any should do the trick for you
https://github.com/NoriginMedia/Norigin-Spatial-Navigation/pull/188/commits/32bc04f01592c46c354cd13a305a3b2321265198 + https://github.com/NoriginMedia/Norigin-Spatial-Navigation/pull/188/commits/9dcbf2615286acaaaaa826d0a5eb3a7487732422
@xavi160 @predikament Could you look at this once more? 🙏
Bump?..
Could somebody with permissions merge this and publish a new version?