Skip to content

HTMLCanvasElement.getContext() missing "webgl" type in lib.d.ts #5773

@GoToLoop

Description

@GoToLoop
getContext(contextId: "2d"): CanvasRenderingContext2D;
getContext(contextId: "experimental-webgl"): WebGLRenderingContext;
getContext(contextId: string, ...args: any[]): CanvasRenderingContext2D | WebGLRenderingContext;

Overloaded getContext(contextId: "experimental-webgl"): WebGLRenderingContext; is missing "webgl" according to these reference sites below:
https://developer.Mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext
http://www.JavaScripture.com/HTMLCanvasElement

Also all the overloaded methods got an optional contextAttributes?: {} parameter.
And I don't think ...args: any[] represents the 2nd parameter correctly.
This is my change proposal for them btW: :-D

getContext(contextType: "2d", contextAttributes?: {}): CanvasRenderingContext2D;
getContext(contextType: "webgl" | "experimental-webgl", contextAttributes?: {}): WebGLRenderingContext;
getContext(contextType: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext;

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issueGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do this

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions