Closed KnorpelSenf closed 1 year ago
When using web workers, one needs to use
/// <reference no-default-lib="true" /> /// <reference lib="deno.worker" />
to make the code compile on Deno.
However, when this is transformed to Node, there is no way to add a built-in library. Hence, the following error is thrown:
src/worker.ts:2:21 - error TS2726: Cannot find lib definition for 'deno.worker'. 2 /// <reference lib="deno.worker" /> ~~~~~~~~~~~ TypeScript 4.9.4 Found 1 errors.
/// <reference lib="deno.worker" />
deno.worker
///
I'm stupid. Solution 1 can already be used by moving the /// directive to the Deno-specific code. Thanks for @MKRhere for pointing this out. Closing.
Problem
When using web workers, one needs to use
to make the code compile on Deno.
However, when this is transformed to Node, there is no way to add a built-in library. Hence, the following error is thrown:
Possible Solutions
/// <reference lib="deno.worker" />
from source files.deno.worker
with the necessary type definitionsUseful Links
///
directives for built-in libs: https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html#-reference-lib-