Skip to content

Missing type declaration for added hooks in WebSocket connection. #408

@DonVietnam

Description

@DonVietnam

Plugin version

11.1.1

Description

I really appreciate the addition of hook support for WebSocket connections, but at the moment it is not possible to integrate them into an application that is checked with typescript without disabling this check, as the type declaration file for the plugin options has not been updated.

No overload matches this call.
Overload 1 of 3, '(plugin: FastifyPluginCallback<FastifyHttpProxyOptions & (FastifyHttpProxyWebsocketOptionsEnabled | FastifyHttpProxyWebsocketOptionsDisabled), RawServerDefault, FastifyTypeProviderDefault, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...>): FastifyInstance<...> & PromiseLike<...>', gave the following error.
Object literal may only specify known properties, and 'wsHooks' does not exist in type '(RegisterOptions & FastifyHttpProxyOptions & FastifyHttpProxyWebsocketOptionsEnabled) | (RegisterOptions & ... 1 more ... & FastifyHttpProxyWebsocketOptionsDisabled)'.
Overload 2 of 3, '(plugin: FastifyPluginAsync<FastifyHttpProxyOptions & (FastifyHttpProxyWebsocketOptionsEnabled | FastifyHttpProxyWebsocketOptionsDisabled), RawServerDefault, FastifyTypeProviderDefault, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...>): FastifyInstance<...> & PromiseLike<...>', gave the following error.
Argument of type 'typeof fastifyHttpProxy' is not assignable to parameter of type 'FastifyPluginAsync<FastifyHttpProxyOptions & (FastifyHttpProxyWebsocketOptionsEnabled | FastifyHttpProxyWebsocketOptionsDisabled), RawServerDefault, FastifyTypeProviderDefault, FastifyBaseLogger>'.
Target signature provides too few arguments. Expected 3 or more, but got 2.
Overload 3 of 3, '(plugin: FastifyPluginCallback<FastifyHttpProxyOptions & (FastifyHttpProxyWebsocketOptionsEnabled | FastifyHttpProxyWebsocketOptionsDisabled), RawServerDefault, FastifyTypeProviderDefault, FastifyBaseLogger> | FastifyPluginAsync<...> | Promise<...> | Promise<...>, opts?: FastifyRegisterOptions<...>): FastifyInstance<...> & PromiseLike<...>', gave the following error.
Object literal may only specify known properties, and 'wsHooks' does not exist in type '(RegisterOptions & FastifyHttpProxyOptions & FastifyHttpProxyWebsocketOptionsEnabled) | (RegisterOptions & ... 1 more ... & FastifyHttpProxyWebsocketOptionsDisabled)'.ts(2769)

Expected Behavior

Type checking should pass without errors, the type declaration file should be supplemented with the types of new hooks and their parameters.

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