-
Notifications
You must be signed in to change notification settings - Fork 93
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
Try to build types with a constructor #59
base: main
Are you sure you want to change the base?
Conversation
I will try it out, if I have some time this week. |
Sorry, this must have slipped past. Can I still help here? |
@janpaepke Yes! This might need to be updated based on the recent changes though, but if you could take a crack at it I would very much appreciate it! |
I could have a crack at the types, but since time is limited I would rather not dig into other changes. |
So I tried it out, and what misses are the |
Are you saying those are the only thing missing to have a working/finished PR or are you saying those are missing for it to be an up to date basis for me to start working on it? |
1fbd549
to
6c5ee86
Compare
@janpaepke I took a crack at updating the types. Can you see if those work? |
All right, I had a look and unfortunately the issue is not resolved. As roughly outlined in #51, the problem is that the That being said, running The correct way of resolving this (imho) is to define the exported SSE object as a class rather than a function. This way jsdoc would understand to include a constructor. But to be honest, the optimal way would be to refactor this to typescript. Since there are comprehensive tests, I could confidently take a crack at this and probably knock something out in a few hours. I would start from Would you like me to? |
Had some time after lunch and did this: https://github.com/janpaepke/sse.js/tree/chore/ts-refactor Check out the changes here. When porting this I made an effort to preserve current functionality, even though the stricter type system revealed several contradictions and even potential bugs, most notably around events. For people preferring "the functional way" we could consider exporting a Before releasing this, should you want to continue down this path, we need to:
|
@mpetazzoni would you like to continue with this? |
@janpaepke Yes! Thanks for this great work. Sorry I haven't had time to look at it closely yet though - just had a baby 😅 |
Oh wow, congratulations. Well I've been there. =) Take your time and we'll revisit this once you had some sleep. |
@janpaepke Following your PR #51, I've tried to clean up the types some more in a way that does produce a constructor. But honestly I no close to nothing about JSDoc and I have no idea if what is produced is correct and will work. Would you mind taking a look at the changes below?
Thanks!