Replace string type with generic in withSaleorEventMatch middleware

This commit is contained in:
Jonatan Witoszek 2022-07-14 16:28:27 +02:00
parent c6307a8c1b
commit 0d93b14e16
No known key found for this signature in database
GPG key ID: 17DB8509239AB834

View file

@ -31,7 +31,7 @@ export const withSaleorDomainPresent: Middleware =
}; };
export const withSaleorEventMatch = export const withSaleorEventMatch =
(expectedEvent: string): Middleware => <E extends string>(expectedEvent: `${Lowercase<E>}`): Middleware =>
(handler) => (handler) =>
async (request) => { async (request) => {
const receivedEvent = request.headers[SALEOR_EVENT_HEADER]; const receivedEvent = request.headers[SALEOR_EVENT_HEADER];