-
-
Notifications
You must be signed in to change notification settings - Fork 627
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
Typescript conversion #2803
Comments
I believe it would be interesting to list both positive and negative points 🙋🏻♂️ A question: Would the tests/tools also be converted or just the main code?
Some notes for this discussion:
|
I may not be the best person to list all the pros and cons. I think the benefit for me is that I'm intending to write a new user-facing API for MySQL using Typescript gives me a very degree of confidence during refactoring that plain Javascript does not give me. So starting off here both lets me give a deeper understanding/appreciation for the existing codebase and will make making changes less painful. I figured since I'm doing this I might as well see if this project would benefit my grind ;) I suppose another benefit is that it's much harder for the typings and code to get out of sync, leading to issues like #2667.
I did not intend to touch the tests, because this gives me a great check ensuring that my conversion didn't break anything. I personally like having my tests in Javascript because so many tests check edge-cases and Typescript tends to complain a lot. A final disclaimer: I don't finish every project I start |
Good point about backlog of PRs / in progress branches that someone will also have to convert after big refactor In general I don't mind this but definitely not high on my priority list. If we speak about "big refactors" I'd rather separate very core protocol ( packets serialisation / deserealisation, raw stream -> raw packets deframing layer, maybe some commands abstraction, maybe using high level packet binary structure description language where possible ) and "user facing api" modules Also, if typescript refactor happen vanilla JS users experience is still a top priority - I want this library to "just work" for node/bun/deno users, regardless of ESM or CSJ and regardless if there is any typescript setup or not |
I'm curious to see this happen but this is definitely out of scope for this module. The focus here is "make communication with server performant, reliable and have decent DX". While there is a bit of "understand what communication happens between client and server and make smart decisions based on that" ( for example, we react on charset change sql because of the changed variables returned as response flags ) we don't try to parse sql in any way. |
Honestly that would be amazing. If this existed today I would just have reached for the core protocol package =)
My assumption is that after this work that everything will still just work as-is. Hoping that there's no BC break break.
Yeah my intent was to use this library to build/experiment with a new user-facing API, but didn't assume that work would be merged in. Just want to give back this specifically the Typescript conversion (provided there was interest). Line count I'm about 50% done. If I finish the work, I'll submit the PR and you can decide what to do with it. And if you decide it's not worth it, that's fine too. |
I've found 1 thing so far I have a hard time understanding. This function: node-mysql2/lib/parsers/string.js Line 10 in a2dd627
takes an node-mysql2/lib/packets/text_row.js Line 14 in a2dd627
(which calls I understand this is not worth your time, esp since you're not sure about this, so feel free to politely decline if this is (or future) questions are a nuisance. |
Interesting, so are you saying that the whole |
I believe |
Hi @sidorares !
I was curious if there's an interest in a total typescript conversion of this project. I started this as an exercise/experiment and noticed the code is hella clean which makes this relatively easy (just a big grind, no big refactors).
If this is a goal of this project to eventually make this switch, I can do the conversion with a future pull request in mind, but if the intent is to keep this a Javascript project I will just keep my fork and make more dramatic changes.
The text was updated successfully, but these errors were encountered: