lib.dom.d.ts
OffscreenCanvas.getContext() not returning type based on context ID
#52831
Labels
Bug
A bug in TypeScript
Domain: lib.d.ts
The issue relates to the different libraries shipped with TypeScript
Help Wanted
You can do this
Milestone
lib Update Request
I would like to request that
OffscreenCanvas.getContext
behaves the same way asHTMLCanvasElement.getContext
in that the latter returns different concrete context types depending on what context ID is passed in as an argument and the former just returns an umbrella context type that needs to be disambiguated first.Configuration Check
My compilation target is
ESNext
and my lib is["DOM", "ESNext"]
.Missing / Incorrect Definition
HTMLCanvasElement.getContext
:OffscreenCanvas.getContext
:I believe it would be beneficial to add overloads with context ID literals which return specific context types.
Also, maybe it would make sense to introduce a context type string literal enum for the normal canvas context types, not just a string?
Documentation Link
The text was updated successfully, but these errors were encountered: