Add typings for react-tracking#20011
Conversation
|
types/react-tracking/index.d.ts Checklist
|
|
@Andy-MS Is there a way to disable these test filename checks? Or am I forced to merge the two test files and e.g. namespace the code? |
fb8e82e to
307c123
Compare
|
We only support one |
Ah yes, of course.
Good question, I should’ve included that. The ‘without’ test verifies that all the defaults work as expected. |
|
@alloy Please fix the failures indicated in the Travis CI log. |
|
|
6cd1b53 to
232d81f
Compare
| * A common use case for this is to dispatch a `pageview` event for every component in the application that has a | ||
| * `page` property on its `trackingData`. | ||
| */ | ||
| process?(ownTrackingData: T): T | Falsy; |
There was a problem hiding this comment.
Nah, it’s defined on line 18.
There was a problem hiding this comment.
I wish it were! :D Maybe we can start our own ‘lib’, also include Flow’s Maybe<T> etc?
There was a problem hiding this comment.
TBH, both of them feel like they can be represented asT? - looks like it was added, then reverted from microsoft/TypeScript#7140 (comment) - but that's probably my Swift experience coming through
types/react-tracking/index.d.ts
Outdated
| export type TrackingInfo<T, P> = T | ((props: P) => T); | ||
|
|
||
| // Duplicated from ES6 lib to remove the `void` typing, otherwise `track` can’t be used as a HOC function that passes | ||
| // through a JSX component that be used wihtout casting. |
232d81f to
dfaac3b
Compare
|
Alright, addressed the feedback, going for the merge. Thanks 👌 |
If adding a new definition:
dts-gen --dt, not by basing it on an existing project.tslint.jsonshould be present, andtsconfig.jsonshould havenoImplicitAny,noImplicitThis, andstrictNullChecksset totrue.https://github.com/NYTimes/react-tracking