workers-types
workers-types copied to clipboard
Generic stream interfaces
Related to #116
It would be easier for packages to support Cloudflare workers and service workers if the stream interfaces matched. Any chance you could update ReadableStream, TransformStream, etc to be generic similar to the standard/web versions?
https://github.com/microsoft/TypeScript/blob/26aea0df613c61edfbfe7b003ff564bea421d071/lib/lib.dom.d.ts#L11917
Couple more I've encountered while migrating cfworker packages:
- Generic stream interfaces
- setTimeout should not require 3rd arg
- BufferSource type is missing (
type BufferSource = ArrayBufferView | ArrayBuffer;) https://github.com/microsoft/TypeScript/blob/26aea0df613c61edfbfe7b003ff564bea421d071/lib/lib.dom.d.ts#L18678 https://github.com/cfworker/cfworker/blob/6342b4653d56a0caa41c32090363354f63845b58/packages/cosmos/src/client.ts#L408 - RequestInfo type is missing (
type RequestInfo = Request | string;) https://github.com/microsoft/TypeScript/blob/90600e1b17edb9072557816657254001a07c3ca0/lib/lib.webworker.d.ts#L5907 - FormData interface has incorrect iterable type:
- [Symbol.iterator](): IterableIterator<([key: string, value: File | string])[]>; + [Symbol.iterator](): IterableIterator<[string, string | File]>;
Agreed. The runtime currently isn't fully conformant here but I don't 100% know if this is just a typing issue or if the underlying implementation may have issues. I'll get someone to chime in.
It's both. Our current implementation and the types aren't 100%. I can say it's being worked on actively as we speak. Can't say exactly when we'll have it delivered in the release, but updates to ensure spec compliance are coming.
Hey! 👋 We'll get these fixed up the next major version of workers-types using the new type generation system. 👍
Hey! 👋 As of @cloudflare/workers-types@4, all of these issues should've been fixed. 🎉