Skip to content

fix type declarations for getContext on raw desktop backend#36182

Draft
Giesch wants to merge 3 commits into
denoland:mainfrom
Giesch:giesch/raw-desktop-type-def-fix
Draft

fix type declarations for getContext on raw desktop backend#36182
Giesch wants to merge 3 commits into
denoland:mainfrom
Giesch:giesch/raw-desktop-type-def-fix

Conversation

@Giesch

@Giesch Giesch commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

This updates the declared types on getContext to match the way they're used in the documentation (returning a GPUCanvasContext for contextId: "webgpu").

I used Claude Code while working on this PR

Giesch and others added 3 commits July 21, 2026 07:56
…dowSurface.getContext

Mirrors the overload set already declared on OffscreenCanvas.getContext,
so getContext("webgpu") narrows to GPUCanvasContext | null instead of
OffscreenRenderingContext | null. The runtime (ext/canvas/byow.rs)
supports exactly the bitmap and webgpu contexts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…enderingContext

Without a construct signature on the constructor objects,
`x instanceof GPUCanvasContext` fails with TS2359 even though it works
at runtime. Matches the @webgpu/types and lib.dom convention.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Giesch
Giesch force-pushed the giesch/raw-desktop-type-def-fix branch from cd9632b to a3263fc Compare July 21, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant