Skip to content

[Web API type definition issue] MediaSourceHandle results in any #2316

Open

Description

@banou26

Summary

MediaSourceHandle results in any making Transferable wrong

Expected vs. Actual Behavior

Currently the type generation for MediaSourceHandle results in

/**
 * The **`MediaSourceHandle`** interface of the Media Source Extensions API is a proxy for a MediaSource that can be transferred from a dedicated worker back to the main thread and attached to a media element via its HTMLMediaElement.srcObject property.
 *
 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MediaSourceHandle)
 */
interface MediaSourceHandle {
}

declare var MediaSourceHandle: {
    prototype: MediaSourceHandle;
    new(): MediaSourceHandle;
};

And empty interfaces are known for being equal to any in TS, so this makes Transferable accept any types, which is wrong.

Playground Link

No response

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

Currently using latest typescript 5.9.3

My workaround for now is using this definition.

interface MediaSourceHandle {
  __dummy__: never
}

Activity

  1. changed the title [-][Web API type definition issue][/-] [+][Web API type definition issue] `MediaSourceHandle` results in `any`[/+] on Dec 24, 2025
  2. Bashamega commented on Dec 24, 2025

    @Bashamega
    Contributor

    Currently, it is empty in blink, webkit, and gecko. It needs more support

  3. HolgerJeromin commented on Dec 24, 2025

    @HolgerJeromin
    Contributor

    It needs more support

    But it is not good if the type is "broken" till than...

  4. saschanaz commented on Dec 24, 2025

    @saschanaz
    Contributor

    #2193 should be able to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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