Cannot find CanvasRenderingContext2D
I am trying to use deno for a web target. Just to transpile all the TypeScript source code into a single JavaScript target. I am compiling with
deno bundle --watch src/index.ts package.js --unstable-sloppy-imports
. With a fairly simple tsconfig.json
:
This is the first time I am using deno, so I'm not really sure if deno requires that I bring in some type hints for a native web target or to adjust the tsconfig.json (or if deno even uses this file) or add in additional cli commands to specify that this will be a web target. But deno currently cannot find CanvasRenderingContext2D
.10 Replies
@crowlKats can you answer that?
i believe lib names need to be lowercase?
I changed the tsconfig to:
Unfortunately, the same issue. I believe this is the lib names you were referring to.
Is there a specific lib I need to specify to enable canvas based features? I am using es2022
Set
, and deno does not complain about that.
Nor does deno complain about the use of window
and other dom commands.Hm, it appears it's indeed present in the
lib.deno.d.ts
that Deno ships with
Which version of Deno are you on?Can you paste your input file and the full output from the terminal
Oh I know what the problem is 😄
Deno doesn't recognize
tsconfig.json
file
You need to pass it explicitly with --config=tsconfig.json
Or move these options into deno.json
Thanks. Moved the file to
deno.json
. All those errors are fixed.
Thanks for your help!Great!