Skip to content

fn invalid parameters after 4.5.1 update #220

@mellinas314

Description

@mellinas314

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

4.20.0

Plugin version

4.5.1

Node.js version

20

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

13.3

Description

After updating plugin to version 4.5.1, my previously existing project has stopped to work with the following error:

Argument of type '(server: FastifyInstance, _: FastifyPluginOptions, done: (err?: Error | undefined) => void) => Promise<void>' is not assignable to parameter of type 'FastifyPluginAsync<FastifyPluginOptions, RawServerDefault, FastifyTypeProviderDefault, FastifyBaseLogger>'.

I've been loking for some update where this change is described and how to update my code to make it works, but can't find anything (downgrading to version 4.5.0, it works again with no problem), but I can't find what I need to change in my call to fp() to make it works with new version.

Steps to Reproduce

After update to fastify-plugin 4.5.1, just try to call fp() with previous working parameters, like:

 fp(async (server: FastifyInstance, opts: FastifyPluginOptions, done: (err?: Error | undefined) => void)  => {
    ........
    done();
});

and it will return following error:

Argument of type '(server: FastifyInstance, opts: FastifyPluginOptions, done: (err?: Error | undefined) => void) => Promise<void>' is not assignable to parameter of type 'FastifyPluginAsync<FastifyPluginOptions, RawServerDefault, FastifyTypeProviderDefault, FastifyBaseLogger>'.

Expected Behavior

To keep working as previous versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions