Vscode_deno: ts errors in js files

Created on 17 Jul 2020  路  8Comments  路  Source: denoland/vscode_deno

Initially, I filed this error with VSCode: https://github.com/microsoft/vscode/issues/102320#issuecomment-659692891

I suspected VSCode because it was just updated, yet I installed Deno at the same time. It turned out that it is clearly related to the Deno extension. See below.


As soon as I upgraded to 1.47 all my purely JS projects started to show TS errors. I don't have TS on my system, nor jsconfig or tsconfig, yet even trivial code produces errors. Before 1.47 it was totally usable for JS/ES projects.

Example of an error to illustrate what I am talking about:

const identity = x => x;

In this example x is highlighted with a red squiggly line showing this error:

(parameter) x: any
Parameter 'x' implicitly has an 'any' type.ts (7006)
Peek Problem (鈱8) No quick fixes available

Why is it an error? I don't want to fix it.

Obviously, if I try to add a type annotation, it errors showing:

Type annotations can only be used in TypeScript files.ts (8010)
Peek Problem (鈱8) No quick fixes available

Which is totally fair. At least we know that it understands that this file is not TS.

Why it is bad and makes my life hell:

  • In the minimap it shows bright red on every line preventing overviewing searches and so on.
  • In the file view (Explorer) all open files are red. I use colors for modified and newly added files. Now I don't know the git status until I close files.
  • I don't like seeing errors where there are no errors. :-)

This is my settings.json just to see that it doesn't have any funny business:


Click me to expand:

{

    "gitlens.advanced.messages": {
        "suppressShowKeyBindingsNotice": true
    },
    "editor.fontLigatures": true,
    "editor.fontFamily": "Fira Code",
    "sync.gist": "0aadafae52deaff8d740ba461b9349c9",
    "sync.quietSync": false,
    "sync.removeExtensions": true,
    "sync.syncExtensions": true,
    "sync.autoDownload": false,
    "sync.autoUpload": false,
    "sync.forceDownload": false,
    "window.zoomLevel": 1,
    "breadcrumbs.enabled": true,
    "cSpell.enabledLanguageIds": [
        "asciidoc",
        "c",
        "cpp",
        "csharp",
        "css",
        "go",
        "handlebars",
        "html",
        "jade",
        "javascript",
        "javascriptreact",
        "json",
        "latex",
        "less",
        "markdown",
        "php",
        "plaintext",
        "pub",
        "python",
        "restructuredtext",
        "rust",
        "scss",
        "shellscript",
        "text",
        "typescript",
        "typescriptreact",
        "yml"
    ],
    "[javascript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[json]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "editor.largeFileOptimizations": false,
    "[jsonc]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "git.autofetch": true,
    "todo-tree.tree.showScanModeButton": false,
    "javascript.suggest.autoImports": false,
    "typescript.suggest.autoImports": false,
    "[html]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "search.searchEditor.reusePriorSearchConfiguration": true,
    "search.actionsPosition": "right",
    "editor.minimap.enabled": true
}

There is a project-specific setting.json:


Click me to expand:

{
    "deno.enable": false
}

Please tell me how I can help you guys to fix this problem.


As you can see in my project settings I have Deno disabled: "deno.enable": false, yet the problem is present as long as the extension is enabled in VSCode. When I disable it and restart the problem is gone. Clearly it proves that the Deno extension is the culprit.

bug

Most helpful comment

This has been resolved in version 3.x of the extension.

All 8 comments

I can confirm disabling Deno extension resolves this issue.

The issue also includes Namespaces of Standart Web API's. It e.g. has a problem with me using Navigator to register a service Worker.

Deno extension is not enabled by default anymore now. Does this fix your error?

@lucacasonato well, by default it does...but what if I want to use the extension? I have to enable it each time, then remember to disable it?

As far as solutions go, it's rather bland.

Just being honest.

As far as solutions go, it's rather bland.

Please let me know if you have a better solution.

@lucacasonato sadly, I do not.

I wasn't trying to be rude, but there's just no way you can honestly tell me you think disabling it is an acceptable solution.

It's like a mechanic telling someone with clutch issues that the solution is to stay in first gear.

I commented on this issue to help make you all aware of it. It seemed insane to me that this extension would interfere with so much. Even non TS stuff....

If you ask me a question, I will answer honestly. You asked if it solved my issue, so I answered.

The problem was that the Deno extension was enabling itself, even in non Deno projects. The solution to that is to disable it by default and only enable it when you explicitly ask for that to happen. I don't see how we can improve this much.

This has been resolved in version 3.x of the extension.

Was this page helpful?
0 / 5 - 0 ratings