-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
Improving TypeScript Support #151
Comments
For reference here is the plugin I have been developing: https://github.com/deevus/analytics-plugin-tapfiliate I will made a PR to include it in the README once I am happy with it. |
Nice plugin! Yeah, the typescript setup is odd. The types are generated from JSdoc with a custom template here then post-processed here because the jsdoc template isn't quite right (or I'm holding the phone wrong). I prefer to keep JSdoc as the main typing mechanism for the time being. If there is a way that typescript There is some active discussion over on JSDOC types at https://github.com/voxpelli/types-in-js/discussions Another typescript issue this project is facing is types for browser implementations vs serverside implementations. It's possible that If you can help solve this problem, you will be my hero forever. |
On some level I think it is possible, but how do you imagine it working? How does the programmer's editor know that they are writing node or browser code? The easiest way would be to have the user import the specific browser/node analytics plugin. You could have the root type be something like const analytics = new Analytics(...) as AnalyticsBrowser; How different are the interfaces? |
I'm loving this package, but the TypeScript types generation is very complicated. Is there a guide on how to contribute types? I understand that the core idea is that the types are generated from JSDoc.
I was hoping to add types for
analytics-utils
as I am developing a new plugin in TypeScript, however I'm a bit lost as to how that should be done.The text was updated successfully, but these errors were encountered: