Skip to content

Type 'OffscreenCanvas' is not assignable to type 'Transferable'. #36823

@Lalavava

Description

@Lalavava

TypeScript Version: 3.7.5

Code

const canvas = document.createElement("canvas")
const offscreenCanvas = canvas.transferControlToOffscreen()
const worker = new Worker(URL.createObjectURL(new Blob([``],{type: "text/javascript"})))
worker.postMessage(offscreenCanvas,[offscreenCanvas])

Expected behavior:
https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas
See "Asynchronous display of frames produced by an OffscreenCanvas" of this document.

Actual behavior:

Compile error:Type 'OffscreenCanvas' is not assignable to type 'Transferable'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions