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
Have Tried The Latest Releases
Additional Context
Currently using latest typescript 5.9.3
My workaround for now is using this definition.
interface MediaSourceHandle {
__dummy__: never
}
Summary
MediaSourceHandleresults inanymakingTransferablewrongExpected vs. Actual Behavior
Currently the type generation for
MediaSourceHandleresults inAnd empty interfaces are known for being equal to
anyin TS, so this makesTransferableacceptanytypes, which is wrong.Playground Link
No response
Browser Support
Have Tried The Latest Releases
@types/web.Additional Context
Currently using latest typescript
5.9.3My workaround for now is using this definition.