-
-
Notifications
You must be signed in to change notification settings - Fork 151
Open
Description
We've established that listeners can be async but I think the listener type might be wrong:
const interceptor = new XMLHttpRequestInterceptor();
interceptor.on('request', async ({ controller, request }) => {
const response = await getResponse(handlers, request);
controller.respondWith(response ?? Response.json({ error: 'msw interceptor error' }));
});ESlint is not happy with the async listener:
/Users/hristo/dev/msw-interceptors-listener-type/src/main.tsx
13:27 error Promise returned in function argument where a void return was expected @typescript-eslint/no-misused-promises
✖ 1 problem (1 error, 0 warnings)
Here's a repo to reproduce the issue:
https://github.com/UnsungHero97/msw-interceptors-listener-type
This might be a type issue in strict-event-emitter but I'm seeing it by using XMLHttpRequestInterceptor.
Metadata
Metadata
Assignees
Labels
No labels