lib Update Request
Configuration Check
My compilation target is ES2015 and my lib is webworker, es2019.
Missing / Incorrect Definition
Canvas-related types, such as CanvasState, are not present in lib.webworker.d.ts in any of the latest releases (4.5.5, 4.6.0-beta etc.). They are only present in lib.dom.d.ts.
This prevents the use of @types/offscreencanvas in webworker sources build.
Somehow confusingly, the missing types are there in your main and release-4.6 (in lib.webworker.d.ts), but not in actual releases in NPM.
Sample Code
Installing @types/offscreencanvas and using "types": ["offscreencanvas"]. No code is needed, because this will fail on its own if webworker lib is used (instead of dom).
Build failure:
Error: node_modules/@types/offscreencanvas/index.d.ts:14:53 - error TS2304: Cannot find name 'CanvasState'.
14 interface OffscreenCanvasRenderingContext2D extends CanvasState, CanvasTransform, CanvasCompositing,
~~~~~~~~~~~
Error: node_modules/@types/offscreencanvas/index.d.ts:14:66 - error TS2304: Cannot find name 'CanvasTransform'.
14 interface OffscreenCanvasRenderingContext2D extends CanvasState, CanvasTransform, CanvasCompositing,
~~~~~~~~~~~~~~~
Documentation Link
MDN specifically mentions that OffscreenCanvas is available in web workers.
lib Update Request
Configuration Check
My compilation target is
ES2015and my lib iswebworker, es2019.Missing / Incorrect Definition
Canvas-related types, such as
CanvasState, are not present in lib.webworker.d.ts in any of the latest releases (4.5.5, 4.6.0-beta etc.). They are only present in lib.dom.d.ts.This prevents the use of
@types/offscreencanvasin webworker sources build.Somehow confusingly, the missing types are there in your
mainandrelease-4.6(in lib.webworker.d.ts), but not in actual releases in NPM.Sample Code
Installing
@types/offscreencanvasand using"types": ["offscreencanvas"]. No code is needed, because this will fail on its own ifwebworkerlib is used (instead ofdom).Build failure:
Documentation Link
MDN specifically mentions that OffscreenCanvas is available in web workers.