Please help clueless professor with Typescript node modules in PHPStorm
Hello.
First, allow me to apologize. I am not a professional programmer and my understanding is often rudimentary. I am a technology teacher at a university, and there is much I do not know. Please treat me like a newbie despite my 30 years of technology experience ;→)
I have been using PHPStorm for several years (Version 2020.2.1, Build #PS-202.6948.87). For the first time, however, I'd like to edit some typescript code. When I try to open up a typescript file, I get the following error:
Error:Initialization error (typescript). Cannot set property parseJsonConfigFileContent of #<Object> which has only a getter
TypeError: Cannot set property parseJsonConfigFileContent of #<Object> which has only a getter
at overrideParseJsonConfigFileContent (C:\Program Files\JetBrains\PhpStorm 2020.2.1\plugins\JavaScriptLanguage\jsLanguageServicesImpl\typescript\session\old\ts-project-service-21.js:37:40)
at Object.extendProjectService21 (C:\Program Files\JetBrains\PhpStorm 2020.2.1\plugins\JavaScriptLanguage\jsLanguageServicesImpl\typescript\session\old\ts-project-service-21.js:6:5)
at Object.createSessionLatestClass (C:\Program Files\JetBrains\PhpStorm 2020.2.1\plugins\JavaScriptLanguage\jsLanguageServicesImpl\typescript\ts-session-latest.js:21:29)
at Object.createSessionClass (C:\Program Files\JetBrains\PhpStorm 2020.2.1\plugins\JavaScriptLanguage\jsLanguageServicesImpl\typescript\ts-session-provider.js:29:36)
at TypeScriptLanguagePlugin.createSessionClass (C:\Program Files\JetBrains\PhpStorm 2020.2.1\plugins\JavaScriptLanguage\jsLanguageServicesImpl\typescript\ts-plugin.js:116:38)
at TypeScriptLanguagePlugin.getSession (C:\Program Files\JetBrains\PhpStorm 2020.2.1\plugins\JavaScriptLanguage\jsLanguageServicesImpl\typescript\ts-plugin.js:109:33)
at new TypeScriptLanguagePlugin (C:\Program Files\JetBrains\PhpStorm 2020.2.1\plugins\JavaScriptLanguage\jsLanguageServicesImpl\typescript\ts-plugin.js:20:30)
at TypeScriptLanguagePluginFactory.create (C:\Program Files\JetBrains\PhpStorm 2020.2.1\plugins\JavaScriptLanguage\jsLanguageServicesImpl\typescript\ts-plugin.js:128:40)
at Interface.<anonymous> (C:\Program Files\JetBrains\PhpStorm 2020.2.1\plugins\JavaScriptLanguage\jsLanguageServicesImpl\js-language-service.js:82:52)
at Interface.emit (node:events:514:28)
I have reviewed many of the posts that seem to relate to this issue, but I'm afraid the solutions are over my head (and I'm never even sure if the problem is the same).
It seems to me that either I'm missing some kind of plugin that I should have, or the plugin I have is old and obsolete and doesn't work. Or perhaps PHPStorm doesn't support Typescript anymore. Or maybe I'm simply missing an option in the preferences. The bottom line is that I'm at a loss and can't figure out what to do next. Can anyone help me? And please be specific.
Thank you in advance for your help. Much appreciated.
CJ
Please sign in to leave a comment.
Hello,
thank you for contacting us.
I would like to know which TypeScript version you currently have selected in Settings | Languages & Frameworks | TypeScript. It looks like your project is using TypeScript 5.x.
Please note that TypeScript 5.x introduced some breaking API changes, which required the TypeScript Language Service support to be re-written. Initial support for version 5 was added in 2023.1. You can find more information at https://youtrack.jetbrains.com/issue/WEB-58390/TypeScript-5.0-Fix-integration-with-TypeScript-Language-Service#focus=Comments-27-6879609.0-0
If you are unable to upgrade PhpStorm, I recommend changing the TypeScript version to Bundled in Settings | Languages & Frameworks | TypeScript.
Thank you.
Whoo hoo - you solved my problem! Yes, I was using TypeScript 5.2.2, and that's what the setting was. I changed it to Bundled and the error went away. Now I'm getting the normal errors that are problems with my code.
Thank you, Thank you, Thank you!!!
CJ Rhoads