When making my own selector with typing
const practitionerAvailability = (state): availabilities => state.practitioner.availability.availabilities;
the returned type from useSelector is still type any when i do something like.
const a = useSelector(practitionerAvailability).
I made a little example in typescript which solves this
function useTypedSelector<T>(selector: (any)=>T): T {
return useSelector(selector)
}
Is there any way you guys could include the behaviour baked into the useSelector function. Thanks :)
After inspection fo your code I can see its not possible at the moment to make this happen as your lib is written in purejs and you use jsdocs for ide intelisense and you can't make this feature happen with the current language. If im wrong please correct me
If you're using TypeScript, we don't maintain the types here. Those are on the DefinitelyTyped repo, so check with them for their support resources.
Thanks I was being silly didn't install @types/react-redux as a dependency. Thanks for pointing me int he right direction
Anyone gotten this to work for javscript in webstorm? I tried providing the typescript definitions like described in https://www.jetbrains.com/help/webstorm/configuring-javascript-libraries.html#ws_jsconfigure_libraries_ts_definition_files but no luck.
@olejorgenb after installing @types/react-redux webstorm worked with type ahead as expected
Most helpful comment
Thanks I was being silly didn't install @types/react-redux as a dependency. Thanks for pointing me int he right direction