Skip to content

Typescript compilation error when passing a restana Service to gateway constructor #50

Closed
@ydarma

Description

@ydarma

Hi,

thank you for your work.

Describe the bug
Cannot pass a restana Service object to the gateway in Typescript.

To Reproduce

import gateway from "fast-gateway";
import restana from "restana";

const server = gateway({
    server: restana(),
    routes: []
});

gives :

error TS2740: Type 'Service<Protocol.HTTP>' is missing the following properties from type 'Server': listen, address, getConnections, ref, and 25 more.

Expected behavior
It should compile.

Solution
in index.d.ts change line 50 :

server?: restana.Server<P>;

to

server?: restana.Service<P>;

This is coherent with line 18 of index.js :

const server = opts.server || restana(opts.restana)

and it works properly (for me).

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