fastify-static icon indicating copy to clipboard operation
fastify-static copied to clipboard

types: replace declaration merging with mixin types

Open flakey5 opened this issue 1 year ago • 1 comments
trafficstars

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

flakey5 avatar Jan 19 '24 21:01 flakey5

The second option can be consumed using the tsconfig.json by 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

voxpelli avatar Sep 02 '24 15:09 voxpelli