How to resolve this issue: "Cannot find name 'Deno'.ts(2304)"?
Hello! I'm new to using Deno, currently on version 2.0.6.
I'm developing with VSCode and have installed the extension provided by Deno. I created a project using
deno init deno_start
. In VSCode, I ran Deno: Initialize Workspace Configuration
and enabled Deno enable
. Here is the content of settings.json
But vscode keeps telling me that Deno cannot be found.
Introducing a /// <reference types="deno.ns" />
at the top of the file does not help. However, with cmd + click
, I can always jump to Deno's type definition files.
I've been searching online for a long time. On GitHub and Discord, a few people encountered the same problem, and they solved it by setting "typescript.tsserver.experimental.enableProjectDiagnostics"
to false
. However, this didn't work for me. I've already added this setting in settings.json
.
Is there any way to solve this issue? Thanks a lot.3 Replies
For already installed dependencies, vscode will prompt both "cannot find" and "Resolved Dependency".
After spending a lot of time, I thought this might be due to vscode's default TypeScript checking. I tried disabling TypeScript checking to resolve the invalid error reports. I modified the configuration as follows. I'm not sure if this is correct, but at least now vscode no longer reports invalid errors to me.
If you have
deno.enable
true then the default TS server should have been disabled. CC @nayeemrmn