MattiasBuelens / web-streams-adapter

Adapters for converting between different implementations of WHATWG Streams
MIT License
32 stars 1 forks source link

Update for TypeScript 4.2 and latest WPT #20

Closed MattiasBuelens closed 3 years ago

MattiasBuelens commented 3 years ago

TypeScript 4.2 no longer contains type definitions for readable byte streams (UnderlyingByteSource, ReadableStreamBYOBReader, or ReadableByteStreamController), since they are not widely supported. We now define these types ourselves as part of this project.

Note that TypeScript may not be able to select the correct overload. For example, this currently needs an explicit type cast:

import { ReadableStream } from 'web-streams-polyfill';
import { createReadableStreamWrapper, ReadableByteStreamLikeConstructor } from 'web-streams-adapter';

const wrapper = createReadableStreamWrapper(ReadableStreamPolyfill as ReadableByteStreamLikeConstructor);

(We may want to consider creating a separate createReadableByteStreamWrapper helper to avoid this... 🤔)

While we're at it, also update to the latest version of the web platform tests and the WPT runner. (We still don't pass all of the tests, but at least we run them. 😛)

Fixes #17.