nytimes / react-tracking

🎯 Declarative tracking for React apps.
https://open.nytimes.com/introducing-react-tracking-declarative-tracking-for-react-apps-2c76706bb79a
Other
1.88k stars 123 forks source link

TypeError on useTracking().trackEvent() #155

Closed sad-squid closed 4 years ago

sad-squid commented 4 years ago

Using @types/react-tracking, the DefinitelyTyped type definitions show that the useTracking().trackEvent() method's return type is explicitly defined as any. Because this raises linting warnings and errors if using @typescript-eslint/no-unsafe-return, I've made a requested change to the types in DefinitelyTyped - link to pull request here.

If there is any concern / issue with the adjustment of typing from any to void please let me know! Feel free to close this issue if valid! ✅

tizmagik commented 4 years ago

That makes sense, thanks for catching this. I see the Definitely Typed has been merged and it looks like a good change to me, so I'll close this issue.

FWIW, we are looking to bring the TS typings in-house here. This PR is a step in that direction and your review would be appreciated! https://github.com/nytimes/react-tracking/pull/152

Thanks again!