Skip to content

Instantly share code, notes, and snippets.

@MattiasBuelens
Created June 27, 2018 18:55
Show Gist options
  • Save MattiasBuelens/196871111c02a27b102239b7c5b449e3 to your computer and use it in GitHub Desktop.
Save MattiasBuelens/196871111c02a27b102239b7c5b449e3 to your computer and use it in GitHub Desktop.
Workaround for WHATWG streams in TypeScript
import {
ReadableStream as WhatWGReadableStream,
TransformStream as WhatWGTransformStream,
WritableStream as WhatWGWritableStream
} from 'whatwg-streams';
export type ReadableStream<R> = WhatWGReadableStream<R>;
export const ReadableStream: typeof WhatWGReadableStream = (self as any).ReadableStream;
export type WritableStream<W> = WhatWGWritableStream<W>;
export const WritableStream: typeof WhatWGWritableStream = (self as any).WritableStream;
export type TransformStream<R, W> = WhatWGTransformStream<R, W>;
export const TransformStream: typeof WhatWGTransformStream = (self as any).TransformStream;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment