DEV Community

Discussion on: Is Declaration Merging and Generic Inheritance at the Same Time Impossible?

mateiadrielrafael profile image
Matei Adriel

Why not just make a ServerBuilder class with a register method which returns a ServerBuilder with the plugin added to some array and some type params changed? Then a .create method would just return a server having the type parameters of the last ServerBuilder instance in the chain

ethanarrowood profile image
Ethan Arrowood Author

Fastify is not written in TypeScript so we need to come up with alternative ways of defining types!