-
Notifications
You must be signed in to change notification settings - Fork 69
Typescript incompatible type in 3.1.0 and Express 4.x #340
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
It appears that the sdk-javascript/src/message/index.ts Lines 21 to 23 in 1fa3a05
In the meantime @aabrams can you try const receivedEvent: CloudEvent = Receiver.accept(req.headers as Headers, req.body); |
Trying what you suggested (req.headers as Headers): Argument of type 'Headers' is not assignable to parameter of type 'import("c:/Users/adam_a/repos/Segment-Webhook/node_modules/cloudevents/dist/transport/http/headers").Headers'. |
Fixes: cloudevents#340 Signed-off-by: Lance Ball <lball@redhat.com>
Trying to add in Express 4.x middleware:
import { Receiver, CloudEvent } from "cloudevents";
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)
The text was updated successfully, but these errors were encountered: