New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript server crash when using typescript-strict-plugin with Typescript 5.4 #70
Comments
@guillaumewuip |
I agree, it seems like the issue is still present |
Could you try version |
@kamkry I tried what you suggested, but just like before, no errors seem to be displayed in TS 5.4. |
@km-tr could you please share the minimal reproducible example? The new version seems to fix the problem from this issue. |
@kamkry Sure, I'll prepare it after work, so please give me a little time. |
For reproducible example you can take a look at #75 this PR. I've bring back e2e tests and they fail on 5.4.5 version |
@km-tr can you try |
Hello there!
I'm using this wonderful plugin on a legacy codebase. We've just migrated to the latest TS 5.4 and text editors typescript integrations are not working anymore (no error reported, no suggestions, etc) (Intellij, VSCode, Neovim).
Here is a minimal repo reproducing the issue: https://github.com/guillaumewuip/typescript-strict-plugin-5.4-bug/blob/main/src/index.ts
I've investigated a bit, and found a potential fix.
Ensuring that we use local TS version (and not the VSCode one), we can find the related log on tsserver side:
Bigger log
This validate that
typescript-strict-plugin
is probably the culprit.When calling TS
getSemanticDiagnostics
here, it leads to a error thrown from typescript language service instance itself:Cannot read properties of undefined (reading 'getSourceFile')
Looking inside typescript code, we understand this means that the
program
variable isundefined
here. Looks like it’s not initialized (anymore?)when the language service instance is created, but only when some methods like are called.Calling
getProgram
just after language service instance initialization fixes the issue.const strictLanguageService = typescript.createLanguageService(strictLanguageServiceHost); +strictLanguageService.getProgram()
Is this a valid fix from your point of view? I will push a PR for that - please don't hesitate to redirect me to a better fix if needed, thanks!
The text was updated successfully, but these errors were encountered: