Clarify canvas ctx.globalCompositeOperation type #34673
Labels
Bug
A bug in TypeScript
Domain: lib.d.ts
The issue relates to the different libraries shipped with TypeScript
Milestone
Uh oh!
There was an error while loading. Please reload this page.
TypeScript Version: 3.6.4
Search Terms:
globalCompositeOperation, TypeScript, union
Code:
The valid strings for
ctx.globalCompositeOperation
can be viewed here: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperationFor example, this is valid:
However, this is invalid:
And yet TypeScript thinks both are valid, because TypeScript simply defines
globalCompositeOperation
asstring
:TypeScript/lib/lib.dom.d.ts
Lines 3376 to 3379 in 29becf0
The following union would provide a better development experience:
The text was updated successfully, but these errors were encountered: