-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[react-tracking] Add types for useTracking hook #35607
Conversation
@damassi Thank you for submitting this PR! 🔔 @alloy - please review this PR in the next few days. Be sure to explicitly select If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead. |
@damassi The Travis CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! |
0d140b7
to
200e3ce
Compare
@damassi The Travis CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! |
200e3ce
to
f443e23
Compare
@damassi The Travis CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! |
0c8f1e1
to
f3f80aa
Compare
f3f80aa
to
e14962a
Compare
/** | ||
* A React hook used to tap into the tracking context. | ||
*/ | ||
export function useTracking<P = {}>(): TrackingProp<P>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn’t allow typing the function without using it, which means we’d need a wrapper function just to restrict it by default to our schema, but we can follow up with that in a later PR.
👌 |
I just published |
Updates types for
react-tracking@7.0.0
, which includes a newuseTracking
hook. In support of this,TrackingProp
now accepts a a generic, which allows us to restrict what props are passed intotracking.trackEvent()
.Example:
npm test
.)If changing an existing definition:
useTracking
React hook nytimes/react-tracking#124