Skip to content

[Web API type definition issue] Extending ReadableStream throws "Base constructors must all have the same return type" error #2456

@yume-chan

Description

@yume-chan

Summary

Extending ReadableStream throws "Base constructors must all have the same return type" error

Expected vs. Actual Behavior

Extending ReadableStream should be allowed (as mentioned in whatwg/streams#160 and whatwg/streams#965), but changes in #1362 cause a TS error when trying to do that

class A extends ReadableStream {
//              ^ Base constructors must all have the same return type. ts(2510)
}

Playground Link

https://www.typescriptlang.org/play/?#code/MYGwhgzhAECC0FMAeAXBA7AJjASgsmYARiAgMooBO+AttAN4BQjAvkA

Browser Support

  • This API is supported in at least two major browser engines (not two Chromium-based browsers).

Have Tried The Latest Releases

  • This issue applies to the latest release of TypeScript.
  • This issue applies to the latest release of @types/web.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions