To reproduce
vscode/settings.json
{
"deno.enable": true
}
tsconfig.json
{
"compilerOptions": {
"noLib": true,
"target": "ES2015",
"module": "esnext",
"lib": ["DOM", "ES2015"],
"strict": true
}
}
a.ts
''.replaceAll('', '');
Expected behavior
replaceAll should be prohibited.
Actual behavior
Intellisense accepts a.ts with no error.
Versions
vscode: 1.49.2 (system setup) e5e9e69aed6e1984f7499b7af85b3d05f9a6883a
deno: 1.4.2
extension: 2.3.1
OS: Windows_NT x64 10.0.19041
Same happens for me. Although for me I can't use the DOM objects at all.
vscode: 1.50.1
deno: 1.4.6
ext: 2.3.2
OS: Mac OS X 10.15.6 (Catalina)
Is there a work around for this? I would like to mix the DOM and Deno code and tried using version 3 but haven't figured out how to get it to work either.
The only thing that has worked for me is to do a clear separation and put Deno code into its own siloed area.
Basically, I would like to just target files as src/**/*.html.ts as DOM even though they will be mixed into Deno code. Note that that code will never be called by Deno I'll just use myFunction.toString() to include it in a script file. I could also just put it in a different directory. It is just nice having them close together.
We likely won't be resolving this bug in the version 2 of the extension, but will resolve in the canary/v3 version which uses the language server built into the Deno CLI.
You can use a ts reference to the file, /// <reference path="./dom.lib.d.ts" /> worked for me ;)
This has been resolved in the 3.x branch of the extension.
@lucacasonato Could you check this issue? I just tested it against 3.1.0, but it doesn't seem to be resolved.
What Deno version are you on? Please update to 1.8.0. (deno upgrade)
>deno --version
deno 1.8.0 (release, x86_64-pc-windows-msvc)
v8 9.0.257.3
typescript 4.2.2
Did you point vscode to the tsconfig using the deno.config option?
I've just inserted "deno.config": "./tsconfig.json" in the first comment example, but nothing changed. "../tsconfig.json" emitted an file not found error.
Very wierd.. If I open a file which includes /// <reference lib="dom" /> first after reloading window, there's no error in a file not having reference pragma. But if I open the file not having the pragma first, red squiggle appears regardless of tsconfig.json lib: ['dom'].
I was just testing dom lib (e.g. HTMLElement) types.
Most helpful comment
Same happens for me. Although for me I can't use the DOM objects at all.
vscode: 1.50.1
deno: 1.4.6
ext: 2.3.2
OS: Mac OS X 10.15.6 (Catalina)