Skip to content

Add typings for react-tracking#20011

Merged
alloy merged 1 commit intoDefinitelyTyped:masterfrom
alloy:react-tracking
Sep 26, 2017
Merged

Add typings for react-tracking#20011
alloy merged 1 commit intoDefinitelyTyped:masterfrom
alloy:react-tracking

Conversation

@alloy
Copy link
Collaborator

@alloy alloy commented Sep 25, 2017

If adding a new definition:

  • The package does not provide its own types, and you can not add them.
  • If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package.
  • Create it with dts-gen --dt, not by basing it on an existing project.
  • tslint.json should be present, and tsconfig.json should have noImplicitAny, noImplicitThis, and strictNullChecks set to true.

https://github.com/NYTimes/react-tracking

@dt-bot
Copy link
Member

dt-bot commented Sep 25, 2017

types/react-tracking/index.d.ts

Checklist

@alloy alloy requested a review from orta September 25, 2017 19:25
@alloy
Copy link
Collaborator Author

alloy commented Sep 25, 2017

@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?

@ghost
Copy link

ghost commented Sep 25, 2017

We only support one foo-tests.tsx file, or you could have a test directory with multiple files. What is the difference between the two test files here?

@alloy
Copy link
Collaborator Author

alloy commented Sep 25, 2017

We only support one foo-tests.tsx file, or you could have a test directory with multiple files.

Ah yes, of course.

What is the difference between the two test files here?

Good question, I should’ve included that. The ‘without’ test verifies that all the defaults work as expected.

@typescript-bot typescript-bot added the New Definition This PR creates a new definition package. label Sep 25, 2017
@typescript-bot
Copy link
Contributor

@alloy Please fix the failures indicated in the Travis CI log.

@ghost
Copy link

ghost commented Sep 25, 2017

test not tests

* 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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL that Falsy is a type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, it’s defined on line 18.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sneaky :D

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish it were! :D Maybe we can start our own ‘lib’, also include Flow’s Maybe<T> etc?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wihtout

@alloy
Copy link
Collaborator Author

alloy commented Sep 26, 2017

Alright, addressed the feedback, going for the merge. Thanks 👌

@alloy alloy merged commit 3f3dea5 into DefinitelyTyped:master Sep 26, 2017
@alloy alloy deleted the react-tracking branch September 26, 2017 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Definition This PR creates a new definition package.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants