-
-
Notifications
You must be signed in to change notification settings - Fork 31
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 TypeScript definition #17
Conversation
Thanks for the PR, but I'm not interested in JSDoc. However, I'm happy to accept TypeScript types if you follow this styleguide? Some examples: |
Sure, I can do that! Please have a look now :) |
package.json
Outdated
"xo": "^0.26.1" | ||
}, | ||
"types": "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.
This is not needed.
index.test-d.ts
Outdated
import setupElectronReloader = require('.'); | ||
|
||
expectType<void>(setupElectronReloader(module)); | ||
expectType<void>(setupElectronReloader(module, { watchRenderer: true })); |
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.
expectType<void>(setupElectronReloader(module, { watchRenderer: true })); | |
expectType<void>(setupElectronReloader(module, {watchRenderer: true})); |
index.d.ts
Outdated
* @param options.watchRenderer - Watch files used in the renderer process and reload the window when they change. Defaults to `true`. | ||
* @param options.debug - Prints watched paths and when files change. Can be useful to make sure you set it up correctly. | ||
* @param options.ignore - Ignore patterns passed to [`chokidar`](https://github.com/paulmillr/chokidar#path-filtering). By default, files/directories starting with a `.`, `.map` files, and `node_modules` directories are ignored. This option is additive to those. | ||
* |
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.
Drop the *
.
index.d.ts
Outdated
*/ | ||
declare function setupElectronReloader( | ||
moduleObject: NodeModule, | ||
options?: { |
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.
Options should be a separate type and each option should have doc comments copied from the readme. See the guidelines.
index.d.ts
Outdated
* setupElectronReloader(module, { ignore: [ 'client/src' ] }); | ||
* } catch (error) { | ||
* console.error('Unable to setup reloading', error); | ||
* } |
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.
Use the example from the readme.
I've implemented the suggestions from your comments and think that it's ready for the second round 👍 |
Thanks :) |
This PR adds TypeScript definition for better developer experience (suggestions in the editor).