Closed ElianCordoba closed 1 year ago
Hello, thank you for the issue! We could move to the class syntax, even though is just syntactic sugar around the prototypal inheritance.
I would not migrate the code to TypeScript, as I don't see a real value-added, but only a maintenance overhead.
(mainly moving from prototypical inheritance to classes)
i would actually argue to go the other direction. pull everything into a a single closure and eliminate this
altogether. since the router is typically a singleton (rarely extended, instantiated once), there should be no impact on performance. it will also compress better, since most internal vars will become private & mangle-able. ES6 classes typically de-suger (ES5) to a larger size than if the source is authored and remains as prototypes.
I would not migrate the code to TypeScript, as I don't see a real value-added, but only a maintenance overhead.
i'm usually in the minority that has this same opinion. now you need a TS compiler to run the code and all potential contributors have to be fluent in TS. i think having a index.d.ts
is sufficient, especially for a ~600 LOC project.
/ $0.02
Hi there, in the last month or so I took a deep dive at the code because I'm writing a post about it (explaining how it work, introducing people to open source). Now that I'm familiarized with the codebase I would like to contribute back.
One of the ideas I had was to re-write the code using modern ES6 syntax (mainly moving from prototypical inheritance to classes), also addressing what was said in this issue https://github.com/fastify/fastify/issues/1972
What do you think about that? Do you have another idea? Maybe as a follow up to the class re-write a migration to Typescript would be easier.