Converting to TypeScript and improving performacnce
Is your feature request related to a problem? Please describe.
No
Describe the solution you'd like
Recreating the whole code with TypeScript and trying to improve it
I have started working on it.
https://github.com/sahithyandev/JokeAPI/tree/typescript-migration
I can't recommend working on it at the moment as there's lots of changes in v2.4.0 (see #239) that would invalidate a big part of a TS rework.
Yeah, you are right. It will surely be a disaster if the typescript code is merged into the main branch now. Actually, I didn't know PR #239 when I started my work. I just saw it about 5 hours ago or so. When I did saw that PR, I decided to stop my work right there. I am gonna leave it as a "proof-of-concept" kinda thing.
What about bringing in a build system? For example, rollup. (the one I have in sahithyandev/JokeAPI##typescript-migration) That way, we can write more modern code. And also, in case, moving to typescript becomes one of the main objectives in a future release, that existing build system, would make the transition so smooth and easy.
What do you think about it?
Could you elaborate on what Rollup does for JokeAPI and how it would be worth implementing?
Rollup (or any other bundler) will allow us to use ES6 imports and the new ES features that node doesn't support yet. And also, tree shaking. But, for JokeAPI, that is not much useful.
Then why did I ask about it? It will allow us to transition to typescript without making any sudden breaks and slowly. We can use typescript and javascript side-by-side. That's the one and only reason.
In conclusion, if there are no plans for typescript in the near future of JokeAPI, it's not worth implementing now. 🙂
I'd definitely want JokeAPI to be converted to TypeScript eventually but if that day comes I'd probably even go as far as rewriting the entire API while I'm already at it, since v2 is built on a very unstable codebase (better than v1 but still very bad).
Gonna put this on hold for now. At this point I can't recommend anyone to refactor the code, especially when v2.4 is currently in the works.
Decided to reopen as rollup does sound like something I'd want to implement eventually, and move on to TS completely, but it's gonna need to be on v2.5.0 or something. I will update this issue once I planned it out and want to start working on it.
Version 3.0.0 is in the works now and it is completely rewritten from the ground up in TypeScript: https://github.com/Sv443-Network/JokeAPI/tree/v3