Skip to content

Worker.postMessage missing optional options parameter #31448

@dasa

Description

@dasa

TypeScript Version: 3.5.0-rc

Search Terms:

Worker MessagePort postMessage

Code

let worker: Worker;
worker.postMessage("test");

let port: MessagePort;
port.postMessage("test");

let either: MessagePort | Worker;
either.postMessage("test"); //  error TS2554: Expected 2 arguments, but got 1.

Expected behavior:

No error. There is no error in 3.4. I'm not sure if this is a bug in the compiler or due to the changes to MessagePort.postMessage in lib.dom.d.ts. Should Worker.postMessage also be updated to have the optional options parameter?

Reference: https://html.spec.whatwg.org/multipage/workers.html#dedicated-workers-and-the-worker-interface

Actual behavior:

error TS2554: Expected 2 arguments, but got 1.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptNeeds More InfoThe issue still hasn't been fully clarified

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions