-
Notifications
You must be signed in to change notification settings - Fork 115
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
Add typings for module and submodules #21
Conversation
46c2d36
to
7f1e6ca
Compare
The DX of these hooks with typings feels pretty rough. Open to suggestions |
I think to fix the DX of using types, we always return |
a2468cb
to
c5af5d9
Compare
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
fc24705
to
1e79965
Compare
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
Rebased and updated to match the hook definitions |
"source": "index.js", | ||
"typings": "index.d.ts", |
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.
It looks duplicated with line 12.
Can we put the type definition file (index.d.ts) inside typings
directory, for example, "typings": "typings/index.d.ts"
?
@@ -0,0 +1 @@ | |||
export function useHardwareConcurrency(): { unsupported: true } | { unsupported: false, numberOfLogicalProcessors: number } |
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.
Could we add semicolon at the end of lines for the purpose of consistency?
According to typescript handbook, they recommend publishing to the @types organization on npm rather than bundling with the npm package if the package is not written in Typescript. What are your thoughts on it? :) |
Thank you for taking the time to work on typings support for the module and submodules, @stramel. I also appreciate the review here, @anton-karlovskiy. My personal take is that given the package is not written in TypeScript and we have no short-mid term plans to rewrite it in TS for now, it would make more sense for typings to be published in the @types organization rather than bundling it with this package. @stramel I think this is a reasonable compromise as it unlocks typings for users that want it. Wdyt? |
@addyosmani I can do that |
Cool. Thank you! With this in mind, I'm going to go ahead and close this PR. Let's follow up with a PR adding a link/note in the README to the typings package once it lands in the types organization? :) |
Added a draft PR for the typings. I need to clean up the typings and add tests. Is there anyone who would want to help maintain these types? |
Adds typings for the main module and submodules.