I have Angular project that has generated web-worker with attached canvas to it using transferControlToOffscreen
. Everything went well until I needed to create another OffscreenCanvas
inside the web-worker. Now the build is throwing TS2304: Cannot find name 'OffscreenCanvas'.
.
I believe it's something with tsconfig
file but I can't for life figure out what it is exactly.
tsconfig.worker.json
:
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/worker",
"lib": [
"es2018",
"webworker"
],
"types": []
},
"include": [
"src/**/*.worker.ts"
]
}
tsconfig.json
:
{
"compileOnSave": false,
"compilerOptions": {
"downlevelIteration": true,
"importHelpers": true,
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2018",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es7",
"dom"
],
"module": "esnext",
"baseUrl": "./"
},
"filesGlob": [
"./src/**/*.ts",
"./test/**/*.ts",
"!./node_modules/**/*.ts",
"src/custom_typings.d.ts",
"typings/browser.d.ts"
]
}