-
Notifications
You must be signed in to change notification settings - Fork 440
lib.dom.d.ts
OffscreenCanvas.getContext() not returning type based on context ID
#1501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
As per: https://github.com/microsoft/TypeScript-DOM-lib-generator#when-the-type-exists-but-is-wrong
This file doesn't have any mention of
This file does have an entry: "OffscreenCanvas": {
"methods": {
"method": {
"getContext": {
"additionalSignatures": [
"getContext(contextId: \"2d\", options?: any): OffscreenCanvasRenderingContext2D | null",
"getContext(contextId: \"bitmaprenderer\", options?: any): ImageBitmapRenderingContext | null",
"getContext(contextId: \"webgl\", options?: any): WebGLRenderingContext | null",
"getContext(contextId: \"webgl2\", options?: any): WebGL2RenderingContext | null"
]
}
}
}
}, It is missing Does this mean |
Prior to version 4.9 we used @types/offscreencanvas for the Would love to see the overrides added to |
This is fixed by #1474. Please try @types/web 0.0.91+ (or equivalent for workers) if you need it today. @github-actions close |
Closing because @saschanaz is one of the code-owners of this repository. |
@saschanaz Awesome! Sorry I searched around in the main TypeScript repository but neglected to search when I moved my issue over to this one after I learnt this is the place to do |
That depends very much on the TypeScript release schedule, and I have no idea about that. What I know is TS 5.0 will include it as microsoft/TypeScript#52328 includes the change. |
Perfect, thanks a lot! |
Will be March 14th |
This is a follow-up to microsoft/TypeScript#52831.
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.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: