fastify-static
fastify-static copied to clipboard
types: replace declaration merging with mixin types
For Fastify v5, background: https://github.com/fastify/fastify/issues/5061
Opened this as it is now to get early feedback & insight. Used a class rather than an interface or type since the type needs to exist at runtime if we go with the currently proposed changes to the fastify-plugin api (see https://github.com/fastify/fastify/issues/5061#issuecomment-1874592015)
TODO:
- [ ] Update/check tests.
cc @mcollina
Checklist
- [ ] run
npm run testandnpm run benchmark - [ ] tests and/or benchmarks are included
- [ ] documentation is changed or added
- [ ] commit message and code follows the Developer's Certification of Origin and the Code of conduct
The second option can be consumed using the
tsconfig.jsonby the following way.{ "compilerOptions": { "types": ["@fastify/static/fastify-global"] } }
This only works for top level projects. I would much prefer it to be handled through an import {} from '@fastify/static/fastify-global', especially as specifying compilerOptions.types disables automatic loading of all @types/ types