Skip to content

Typescript incompatible type in 3.1.0 and Express 4.x #340

Closed
@aabrams

Description

@aabrams

Trying to add in Express 4.x middleware:

import { Receiver, CloudEvent } from "cloudevents";

const receivedEvent: CloudEvent = Receiver.accept(req.headers, req.body);

It fails with:

(property) IncomingMessage.headers: IncomingHttpHeaders
Argument of type 'IncomingHttpHeaders' is not assignable to parameter of type 'Headers'.
Index signatures are incompatible.
Type 'string | string[]' is not assignable to type 'string'.
Type 'string[]' is not assignable to type 'string'.ts(2345)

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