[X] I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.21.0
Plugin version
4.3.0
Node.js version
18.x
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
Monterey
Description
Trying to migrate JS->TS for a NodeJS backend service. After changing index.js -> index.ts all my fastify plugins are fine (e.g. FastifyOpenapiDocs, FastifyMultipart, FastifySentry), but FastifyAuth has this error:
No overload matches this call.
Overload 1 of 3, '(plugin: FastifyPluginCallback<{ defaultRelation: string; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...>): FastifyInstance<...> & PromiseLike<...>', gave the following error.
Argument of type 'typeof fastifyAuth' is not assignable to parameter of type 'FastifyPluginCallback<{ defaultRelation: string; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
Type 'typeof fastifyAuth' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
Type 'typeof fastifyAuth' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, FastifyBaseLogger, FastifyTypeProvider>, opts: { ...; }, done: (err?: Error) => void): void'.
Overload 2 of 3, '(plugin: FastifyPluginAsync<{ defaultRelation: string; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...>): FastifyInstance<...> & PromiseLike<...>', gave the following error.
Argument of type 'typeof fastifyAuth' is not assignable to parameter of type 'FastifyPluginAsync<{ defaultRelation: string; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
Type 'typeof fastifyAuth' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, FastifyBaseLogger, FastifyTypeProvider>, opts: { ...; }): Promise<...>'.
Overload 3 of 3, '(plugin: FastifyPluginCallback<{ defaultRelation: string; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger> | FastifyPluginAsync<...> | Promise<...> | Promise<...>, opts?: FastifyRegisterOptions<...>): FastifyInstance<...> & PromiseLike<...>', gave the following error.
Argument of type 'typeof fastifyAuth' is not assignable to parameter of type 'FastifyPluginCallback<{ defaultRelation: string; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger> | FastifyPluginAsync<...> | Promise<...> | Promise<...>'.ts(2769)
Steps to Reproduce
Code looks something like:
// index.ts
import * as FastifyAuth from '@fastify/auth';
fastify.decorate('authfunc1', authfunc1);
fastify.decorate('authfunc2', authfunc2);
await fastify.register(FastifyAuth, { defaultRelation: 'and' }); //error under `FastifyAuth`
Prerequisites
Fastify version
4.21.0
Plugin version
4.3.0
Node.js version
18.x
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
Monterey
Description
Trying to migrate JS->TS for a NodeJS backend service. After changing index.js -> index.ts all my fastify plugins are fine (e.g. FastifyOpenapiDocs, FastifyMultipart, FastifySentry), but FastifyAuth has this error:
Steps to Reproduce
Code looks something like:
Expected Behavior
No response