question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ts errors in js files

See original GitHub issue

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 (⌥F8) 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 (⌥F8) 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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
lucacasonatocommented, Feb 19, 2021

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

2reactions
oze4commented, Jul 17, 2020

I can confirm disabling Deno extension resolves this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Removing [ts] errors from JS files In VS Code - Stack Overflow
Yes. The TypeScript extension powers our javascript intellisense which is why you see [TS] in your js file. That only indicates what extension ......
Read more >
ts errors in js files · Issue #102320 · microsoft/vscode - GitHub
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...
Read more >
Remove [ts] errors from JS files - Medium
Remove [ts] errors from JS files · Disable this extension: Go to packages and search for “@builtin” and disable it. · Install eslint...
Read more >
[VS2022] Multiple errors shown when adding a JS file to a TS ...
Multiple javascript errors appear when adding a JS file to a TS project. Those errors are assigned to a non-existing project named “XXXX...
Read more >
Documentation - Type Checking JavaScript Files - TypeScript
Here are some notable differences on how checking works in .js files compared to .ts files. Properties are inferred from assignments in class...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found