question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[types] `Response.body` does not extend `ReadableStream`

See original GitHub issue

The browser’s Response.body is ReadableStream.

Based on fetch.d.ts Response.body of undici is just ControlledAsyncIterable.


The code below is valid and workable. However, because of fetch.d.ts I see the warning in my IDE (IntelliJ IDEA).

const response = await fetch(url);

/** @type {ReadableStream} */
const body = response.body; // Warning: "Initializer type ControlledAsyncIterable is not assignable to variable type ReadableStream"
body.getReader();
const response = await fetch(url);

const body = response.body;
body.getReader(); // Warning: "Unresolved function or method getReader()"

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mcollinacommented, Apr 26, 2022

Ah your PR did it! It was just not tagged with “closes #issue” so this would get closed automatically.

1reaction
fraxkencommented, Mar 30, 2022

I will work on it and make a PR

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using readable streams - Web APIs | MDN
The Request.body and Response.body properties are available, which are getters exposing the body contents as a readable stream.
Read more >
Argument of type 'ReadableStream<any>' is not assignable to ...
I want to get a Readable form a Blob. import {Readable} from 'stream'; const data: Blob = ...
Read more >
Streams—The definitive guide - web.dev
The ReadableStream() constructor creates and returns a readable stream object from the given handlers. There are two types of underlying source:.
Read more >
Stream | Node.js v19.3.0 Documentation
The node:stream module is useful for creating new types of stream instances. It is usually not necessary to use the node:stream module to...
Read more >
A Guide to Faster Web App I/O and Data Operations with ...
There are only two types of streams in the WHATWG specification, ... If the response body is not a readable stream, a readable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found