`deno check` error: Cannot find name 'Deno'`

In my project, deno check has started producing the error TS2304 [ERROR]: Cannot find name 'Deno' . I've found a lot of reports about this error coming from the VS Code extension, but in my case it's coming from Deno itself, and the VS Code extension does NOT show this problem. I'm quite confused! Can anybody suggest a solution please? In case it helps anyone else: I resolved the problem by adding /// <reference lib="deno.ns" /> to the top of the module that used the Deno object. I still don't know why that became necessary (after updating a dependency?), and why is it not necessary in every module that uses Deno
Probably because a dependency uses a directive like this an overrides the default library. Vscode should provide you with a hint to add this exact reference
Ah, thanks. I didn't see a hint from VS Code. Since the Typescript compiler is bundled inside Deno itself in this case, would it be possible to make a change in Deno so that this is unnecessary? I assume there's no scenario where Deno is unavailable?
I'm not sure, kinda makes sense. @dsherret thoughts on this?
ABAltair 680b9/8/2023
It's been my experience that once you add a /// <reference to a file, it's represented in all other files. At least in main.ts, in my case. I write all front end code in TS and bundle with esbuild. In main.ts, I add /// <reference lib="dom" />, and never need to add it in other files. VSCode on Windows.
Prevent no-default-lib removing Deno global? · Issue #20420 · den...
It is quite annoying to import something and it has a /// <reference no-default-lib="true" /> directive as it will remove the Deno global. Perhaps we should look into if there's...
That's awesome, thanks!

Looking for more? Join the community!

Recommended Posts
Read CSV files inside zip file using the web streams APII need to read a number of csv files inside a zip file. The basic example I've got working so far isUnable to find local file with installed deno moduleI am working on porting the 'octoherd/cli' to Deno. One of the things it does is load a script modulImporting NPM packages with `npm:` where package has `@` in the nameI want to import the package `@hono/zod-openapi`, version `0.30` I tried to add to my `deno.json` lHow to use KV Connect?Hello there <:HelloThere:730465880991072285> Is there any plan an making an STD module for creatindlopen() from web urlHey, is it possible to provide a url to the dll file from a cdn server? For example if I want to dDoes calling `bundle` inside a handler make sense?hey all I wanted to understand if this is smart to do. I am using the `cacheRoot` option and wanted Is WASM generally faster than using Deno FFI?...Deno hanging when trying to connect with MongooseWhen I try to connect to MongoDB using Mongoose the whole process just hangs until eventually timingEmbeding Dino compiled code within rust (Tauri) code, inside main.rs during build compilation.Hi. Still not sure if this is question for Tauri community or Deno community, so I'll place on both DuckDB deno package broken & npm package segfaultingHas anyone had any luck using DuckDB with Deno? I've tried with the npm package with segfaults on a Get Deno working with ESLintHi! I'm trying out a Deno project and I want to get Deno TS Typing working with ESLint. I understanInstall issueI am triyng to instal Deno but i always get this error and I cant solve it. Help pls!LSP: Uncached or missing @types/node when importing node:processI'd like to understand better what's going on here in case it's a potential bug in node interop: ```Deno vs Node for writing a React component library.Hi all. I love Deno and what it does, but I need some help deciding if it is right for my small projrun code at the start of every hourI would like the most performant code pls.Denoflare scheduled workersCloudflare has a cronjob feature for running workers at a scheduled time. Wrangler has a flag wranglHow to make a function whose return type is inferred to be the same as an input function'sThis is what I got so far. ```ts type Context = { abc: string, def: boolean } /* HAVE TO Tfresh.gen.ts blankhey folks. I've been using fresh for a while as a hobbist. Recently started a new project using thCan extension state have fields that require passing lifetime?It is possible to pass bounds and parameters to the extension! macro but as far as I see it doesn't Limits for background tasksI was thinking of making a filter page for users of multible game cdns, like steam, epic games, and