react-tracking icon indicating copy to clipboard operation
react-tracking copied to clipboard

Update @types/react-tracking

Open Sicria opened this issue 4 years ago • 4 comments

Is it possible to update the types for the useTracking hook to allow for passing in an object.

Sicria avatar Dec 13 '20 02:12 Sicria

Yes, that'd be great. TypeScript types via DefinitelyTyped, @types/react-tracking, are a community-driven effort currently. Although we do have plans to rewrite the internals to TypeScript and thus export type definitions directly (see #152 for WIP or if you'd like to contribute)

Also as noted in #173 by @mattes3:

the typescript types are not up to date. They correspond to version 7. They are missing the property Track in the object that is returned by the useTracking() hook.

tizmagik avatar Jan 04 '21 19:01 tizmagik

Hi all. I ran into an issue where, in TS, I couldn't pass a function as the first argument to useTracking and then in turn use the return value of that function in dispatch. I opened a PR(linked above) and I believe that it's accurate. Not 100% but I've already made the changes in my project's d.ts file and everything is working as expected. Let me know if there's anymore information you'd like or if there's more I could do here.

Thank you! Love the library.

trescenzi avatar Apr 21 '22 23:04 trescenzi

Just wanted to bump this. I've gotten approval from the definitivelytyped maintainers but will wait till the evening of 5/3, or someone here says otherwise, to merge it in case anyone from this repo has opinions on the change. I've got the changes locally running on a production site so I'm pretty certain it's safe, just want to make sure the owners of this repo don't have any issues with it.

trescenzi avatar May 01 '22 21:05 trescenzi

Those updates look good @trescenzi -- thanks so much for contributing. It's greatly apprecaited!

tizmagik avatar May 02 '22 18:05 tizmagik