Typescript errors not shown in code analysis

Webstorm Version 2019.2.4

Typescript Version 3.7.2, but also occurs on bundled 3.5.2

 

My code has some typescript errors which are shown in the editor and in the typescript service. Running code inspection does not report these errors.

Since the typescript service is mostly invoked on basis of the active file, you don't always see all errors right away. I would expect that the code analysis picks up these errors as well and warns me, since the editor is showing them on a file basis.

I like to run code analysis on commit, but for now it seems that I have to track the typescript errors separately. I've also added type check to my pre-commit hook as a workaround?

Is this intended behaviour or did I mess up my webstorm settings? Couldn't find anything different about it in here.

Additional Context: The type mismatch inspection is enabled, severity error, all scopes.

0
19 comments

it's expected - errors reported by the Typescript compiler service are shown in the editor/dedicated tool window but not included in inspections results shown on Code | Inspect code

0

Okay, i've played around with it a bit more and I don't think the behaviour is as expected.

There are inspections for typescript, e.g. type mismatch. None of these errors get included in code analysis. Selection run inspection by name does return 0 suspicious code, even if the typescript service is clearly showing some.

I understand, that not all service errors are 1:1 included in the code analysis report, but what's the point of of these inspections, if they don't do anything?

I don't expect any error to be shown in the inspections window, but I would expect some errors - like type mismatch - to be shown, if there is an error. Do you agree?

0

>I understand, that not all service errors are 1:1 included in the code analysis report, but what's the point of of these inspections, if they don't do anything?

 

when the language service is enabled, errors produced by WebStorm own static syntax analyzer, like type mismatch, are suppressed to avoid duplication. So only code style issues that aren't reported by the service are included in the code analysis report

0

Ah okay, missed that in the docs. Thank you. Then I'll see whether disabling the typescript service makes my experience better or worse.

0

This still seems to be an issue for me in PhpStorm 2024.1. Although it's mentioned here that it's on purpose that TypeScript's analyzer is not run in the Analyze Code bit before committing, I was hoping the IntelliJ team would have changed their mind about this.

0

this issuse still exits in 2024.2 and 2024.3EAP
I cant work with it. Why is this issues not getting more attention?

0

Marcus Stueben Can you please describe it in more detail? 

0

The Problem is that the Typescript Errors are not showing in the Code Window. Also the “Problem” Windows show no error. When i try the compile option the error i shown in the result window.

This is a NextJS Project

Seems that the issue also tracked here: ESLint errors are missing from the file context after IDE opening for a while : WEB-64982 (jetbrains.com)

After Compile

This is my Typescript Config
 

MySetup

Windows 11 with WSL2 all the newest updates installed. PHPStrom is install on my windows machine and all code and node things are in the WSL. So far in 2023 all fine. Looks good.

PHPStorm Version and also happend in 2024.2

PhpStorm 2024.3 EAP
Build #PS-243.15521.35, built on September 20, 2024
Licensed to PhpStorm EAP user: xxxx
Expiration date: October 20, 2024
Runtime version: 21.0.4+8-b598.4 amd64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
Windows 11.0
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 8096M
Cores: 16
Registry:
  run.processes.with.pty=TRUE
  ide.experimental.ui=true
  i18n.locale=
Non-Bundled Plugins:
  com.mnr.java.intellij.idea.plugin.base64helper (2.0.3)
  com.jetbrains.space (243.15521.24)
  com.intellij.grazie.pro (0.3.334)
  PlantUML integration (7.11.2-IJ2023.2)
  org.intellij.prisma (243.15521.24)
  com.jetbrains.lang.ejs (243.15521.24)
  ru.adelf.idea.dotenv (2024.3)
  unicorn.bar (1.1.4)
0

Could you please share the logs from the TypeScript language service? To collect the service logs please go to Help | Diagnostic Tools | Debug Log Settings… and add #com.intellij.lang.javascript.service.JSLanguageServiceQueue:trace to the Custom Debug Log Configuration window. Then restart the IDE, reproduce the issue, and send us the IDE’s logs (these can be collected via Help | Collect Logs and Diagnostic Data …).

0

Elena Pogorelova  

It is possible to send you the logs via email. I dont want to publish these logs. could be sensetive data in there
 

0
Please upload the files via https://uploads.jetbrains.com/ form and let me know the ID.
0

Upload id: 2024_09_26_2B2TB5isWJJtQHWsYBPT86 (file: phpstorm-logs-20240926-1055332820251615175254266.zip)

0

Thank you for the logs!
According to them, the WSL paths start with \\wsl$\... for you. On Windows 11 they should normally start with \\wsl.localhost\....
Can you please close the project and open it again using File -> Open? You should see \\wsl.localhost\... path in the file chooser that opens up.
Does the issue persist?

1

Oh no. That was the problem! Thx a lot fot that hint. 

0
Glad to hear it helped!
0

Unfortunately I have precisely the same error and same settings as the original post. Though I'm on OSX and reopening the project did not fix the problem. I also tried invalidating caches and use the "Repair IDE" option without success.
I uploaded the diagnostics as suggested using the form. The upload ID is 2024_12_16_YXBJqz1onNtXSBgHpEsmvb

Can you suggest a solution to this problem ?

0

Lennert Schneider  Unfortunately, it’s not quite clear what error you refer to. Can you please describe the issue in more detail?

0

Oh sorry,

the issue is that typescript errors are not highlighted (though I'm using PyCharm, but these parts seem to be equivalent). The language server is running, but I don't see wiggly lines in the editor nor do I see them in the Problems view. Strangely I can see warnings about unused imports, but no errors (even very obvious ones like a variable not being declared). However trying to compile will show me those errors in the build view.

This is seemingly the same behavior as described by Marcus Stueben here: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360006555999/comments/21587240568594

 

EDIT: I found the issue. It was seemingly caused by a dependency called “typescript-strict-plugin” which caused this behavior. As soon as this is present in the node_modules folder the error highlighting seizes to work.
 

0

Thanks for investigations! the issue looks similar to WEB-61554, please follow it for the updates.

1

Please sign in to leave a comment.