You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a project which previously used @types/offscreencanvas for OffscreenCanvas support. That library defines separate overloads for the different getContext types:
When pulling in the new changes via microsoft/TypeScript#51300 in TS 4.9.4, it seems like there's only one definition of getContext, so my calls to e.g. getContext("2d")?.clearRect(...) now fail to compile:
Property 'clearRect' does not exist on type 'CanvasRenderingContext2D | OffscreenRenderingContext'.
Property 'clearRect' does not exist on type 'ImageBitmapRenderingContext'.ts(2339)
It would be nice to use the same approach of overloading based on the contextType parameter so that the proper types can be used without an as downcast.
The text was updated successfully, but these errors were encountered:
I have a project which previously used
@types/offscreencanvas
for OffscreenCanvas support. That library defines separate overloads for the differentgetContext
types:https://github.com/DefinitelyTyped/DefinitelyTyped/blob/a6b57ed5f511b6d1c842b6acb4961c966d4afb00/types/offscreencanvas/index.d.ts#L46-L58
When pulling in the new changes via microsoft/TypeScript#51300 in TS 4.9.4, it seems like there's only one definition of
getContext
, so my calls to e.g.getContext("2d")?.clearRect(...)
now fail to compile:It would be nice to use the same approach of overloading based on the contextType parameter so that the proper types can be used without an
as
downcast.The text was updated successfully, but these errors were encountered: