Page 1 of 1
VisualStudioCode reports messages
Posted: Mon Apr 13, 2026 9:32 am
by marsch
Hi,
after update of Switch to version 25.11 VisualStudioCode (VSC) reports messages that I do not fully understand nor know how to solve
Extract from VSC messages, see also attched screendump
Cannot find name 'Switch'.
[{
"resource": "/c:/Users/eivdt/Documents/122-script-nodejs-ts/filePathChunks/main.ts",
"owner": "typescript",
"code": "2304",
"severity": 8,
"message": "Cannot find name 'Switch'.",
"source": "ts",
"startLineNumber": 8,
"startColumn": 30,
"endLineNumber": 8,
"endColumn": 36,
"modelVersionId": 1,
"origin": "extHost1"
}]
Cannot find name 'FlowElement'.
[{
"resource": "/c:/Users/eivdt/Documents/122-script-nodejs-ts/filePathChunks/main.ts",
"owner": "typescript",
"code": "2304",
"severity": 8,
"message": "Cannot find name 'FlowElement'.",
"source": "ts",
"startLineNumber": 8,
"startColumn": 51,
"endLineNumber": 8,
"endColumn": 62,
"modelVersionId": 1,
"origin": "extHost1"
}]
VSC is updated. npm is updated to version 11.12.1. Did not help.
What has happned?
How can this be solved?
Best regards
Martin
Re: VisualStudioCode reports messages
Posted: Mon Apr 13, 2026 5:48 pm
by samw
Hi Martin,
This is not caused by the upgrade to Switch 25.11 but by a very recent VS Code update. VS Code now uses TypeScript 6.0 which requires ambient/global type definitions (such as the
switch-scripting type definitions) to be explicitly included in
tsconfig.json, and deprecates
moduleResolution="node".
We are making sure that script folders created with the next Switch version are compatible, but any existing script folders created in Switch 25.11 or earlier will need to be updated accordingly, if using a recent VS Code version which depends on TypeScript >=6.0.
There are basically two approaches:
- Update tsconfig.json to make the project compatible with TS v6 (potential for conflict with existing SwitchScriptTool)
- Set up VS Code for compatibility with older TypeScript version (v4.6.3 for Switch 24 Fall and 25.11)
I would suggest the latter, which can be done like this:
1. Install TypeScript 4.6.3 as a dev dependency:
2. Create .vscode/settings.json with the following content:
Code: Select all
{
"typescript.tsdk": "node_modules/typescript/lib"
}
3. Open VS Code command pallette (Ctrl/Cmd + Shift + P)
Search/select
"TypeScript: Select TypeScript version..."
Choose
"Use workspace version (4.6.3)"
Now everything will work as expected.
Re: VisualStudioCode reports messages
Posted: Wed Apr 15, 2026 11:25 am
by samw
In case anyone has trouble attempting the workaround in my previous reply, please note that the Typescript commands are only available in the VS Code Command Palette if a .ts file is open in the active tab.
Re: VisualStudioCode reports messages
Posted: Wed Apr 15, 2026 12:34 pm
by jan_suhr
It might be an idea to add this information to the Script Documentation. I had the same problem and got help from Freddy to fix it.
Re: VisualStudioCode reports messages
Posted: Wed Apr 15, 2026 2:35 pm
by marsch
Hi,
I tried this and I do not get it to work. Tried both the script folder and a more global folder. Nope, sorry I do not get it right.
Questions
Where to exactly install TypeScript 4.6.3?
In the script folder herarchy ...\node_modules\typescript?
There are several .vscode folders.
In which one should .vscode/settings.json be placed?
When doing a search for TypeScript, nothing is found, see attached screendump.
What am I doing wrong?
/Martin
Re: VisualStudioCode reports messages
Posted: Thu Apr 16, 2026 5:48 pm
by freddyp
installs that version of TypeScript in your script folder and then you will see that the workspace version is available in the Command Palette.
Re: VisualStudioCode reports messages
Posted: Fri Apr 17, 2026 6:16 pm
by samw
As Freddy mentioned, this is all local to the script folder. So the settings file should be created in the
.vscode/ subfolder within your script folder, and Typescript should be installed as a dev dependency of your script.
This has to be done for every script folder unfortunately – there is no global 'fix', because the existing tsconfig.json is not compatible with TypeScript 6. We are also considering how upgrading script folders can be made easier in the future to help resolve this type of issue.
If you are happy to ignore the depreciation warning for "moduleResolution": "node", you can ignore all of this and simply add to your tsconfig.json:
Code: Select all
"types": ["node", "switch-scripting"]
This is how new script folders will be created in the next release. That deprecation warning can to be ignored as SwitchScriptTool is bundled with a compatible version of TypeScript (and node), and the transpile will not complain.
This information will be included in the documentation for the next release and will be communicating the details to app creators and scripting users next week.