Skip to content

add typings! #53

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

Closed
wants to merge 2 commits into from
Closed

add typings! #53

wants to merge 2 commits into from

Conversation

ricokahler
Copy link
Contributor

Here you go!

Here are some typings to your amazing library ❤️

Some info:

  • All the typings are in one file index.d.ts. There are other approaches to this (e.g. ambient typing files next to the file) but this seems to be the best way to do it and maintain it given your project structure.
  • The only "tests" I wrote were for the more complex typings regarding the withController HOC. HOC typings are a bit more complex than normal component because the HOC needs to capture the incoming props, ensure they satisfy the props being injected, and also remove those props from the external API for the component. The rest of the typings are untested because they are more declarative.

Things to consider:

  • If you don't know typescript and you don't want to maintain the TS code for this library, we can alternatively put these typings in the @types/ mono repo where the community maintains the types for you.
  • If you wish your types to be 100% in-sync and you wish to control them internally then merge this PR (or similar) in.

Let me know if you have any questions and thanks again for the great library!

@codecov-io
Copy link

Codecov Report

Merging #53 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #53   +/-   ##
=======================================
  Coverage   91.75%   91.75%           
=======================================
  Files          26       26           
  Lines         279      279           
  Branches       46       46           
=======================================
  Hits          256      256           
  Misses         18       18           
  Partials        5        5

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8b23a86...c8ae37e. Read the comment docs.

@jscottsmith
Copy link
Owner

@ricokahler Thanks, appreciate the contribution and explanations -- very helpful!

Assuming the index.d.ts will need to be published with package? And/or additional files?
The entire src isn't published currently, only the following files/folders - see here

I'd like to setup a simple React TypeScript project and try it out so that I'm more familiar with the process. Other than that this is looking good!

@ricokahler
Copy link
Contributor Author

@jscottsmith oh yes the index.d.ts file should be published along side the index.js file of the library. I forgot about that!

I'd like to setup a simple React TypeScript project and try it out so that I'm more familiar with the process.

Let me know if you need any help or if you think publishing to @types is better

@jscottsmith jscottsmith mentioned this pull request Apr 4, 2019
@jscottsmith
Copy link
Owner

@ricokahler really appreciate the PR -- merged these changes with #55 and published in v2.0.6

@jscottsmith jscottsmith closed this Apr 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants