Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Typescript lib es2024 and arrayBuffer, types are hard to use #2388

Open
4 tasks done
danilofuchs opened this issue Dec 10, 2024 · 0 comments
Open
4 tasks done
Labels
bug Something isn't working needs:triage Issues that have not been investigated yet. scope:node Related to MSW running in Node

Comments

@danilofuchs
Copy link

danilofuchs commented Dec 10, 2024

Prerequisites

Environment check

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

Node.js version

v22.12.0

Reproduction repository

https://github.com/danilofuchs/examples/blob/main/index.ts

Reproduction steps

  • Set lib to es2024 or esnext to use features such as Object.groupBy
  • Read a file using readFile or create a mocked buffer using Buffer.from("fake-file")
  • Try to pass this to HttpResponse.arrayBuffer

Current behavior

Typescript does not allow, but msw accepts it in runtime:

image

Expected behavior

Previous lib versions works as expected

This is due to the introduction of SharedArrayBuffer in lib es2024

Using the output of readFileSync is documented as supported by msw:
image

@danilofuchs danilofuchs added bug Something isn't working needs:triage Issues that have not been investigated yet. scope:node Related to MSW running in Node labels Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs:triage Issues that have not been investigated yet. scope:node Related to MSW running in Node
Projects
None yet
Development

No branches or pull requests

1 participant