Skip to content

fn type bound in Server.register might be slightly off #139

@SamWilsn

Description

@SamWilsn

The type bound for fn in register has a void return type:

register(name: string, fn: (params: IRPCMethodParams, socket_id: string) => void, ns = "/")

I'm rather new to TypeScript, but I would suggest a return type of unknown | Promise<unknown> to hint that the function is await'd later on:

response = await this.namespaces[ns].rpc_methods[message.method]
.fn(message.params, socket_id)

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