msw icon indicating copy to clipboard operation
msw copied to clipboard

"Cannot read properties of undefined (reading 'get')" when using generators/async generators as resolvers

Open juliusmarminge opened this issue 1 year ago • 2 comments

Prerequisites

Environment check

  • [X] I'm using the latest msw version
  • [X] I'm using Node.js version 18 or higher

Node.js version

20.11

Reproduction repository

https://github.com/juliusmarminge/msw-async-generator

Reproduction steps

bun i && bun run test

Current behavior

CleanShot 2024-03-25 at 13 01 38@2x

Expected behavior

According to the docs here: https://mswjs.io/docs/recipes/polling async generator should be supported

juliusmarminge avatar Mar 25 '24 12:03 juliusmarminge

Note that there are 2 issues here:

  1. async generators are not allowed on the type level
  2. the test fails in runtime

juliusmarminge avatar Mar 25 '24 12:03 juliusmarminge

Hi, @juliusmarminge. Thanks for reporting this!

I looked into it and indeed uncovered two issues in MSW that caused this. Addressed both in https://github.com/mswjs/msw/pull/2108. Also added missing integration tests for these cases.

kettanaito avatar Mar 25 '24 12:03 kettanaito

Released: v2.3.3 🎉

This has been released in v2.3.3!

Make sure to always update to the latest version (npm i msw@latest) to get the newest features and bug fixes.


Predictable release automation by @ossjs/release.

kettanaito avatar Jul 23 '24 14:07 kettanaito