Liviu Uba
Liviu Uba

Reputation: 21

VS Code how to configure a project with isolated type system per individual Js file

The problem. I want to have a folder with multiple ES5 JavaScript files.

By default the JavaScript/Typescript workspace treats all files as a single project, so variables defined in one js file are visible in any other file in the project.

Unfortunately these files are used for scripting a desktop application and they are executed in different typing contexts, so sharing the variables is not be permitted.

How to configure my workspace in VSCode, (eventually via an extension ) to achieve type system isolation between these files. I cannot use any type of module imports.

Upvotes: 1

Views: 155

Answers (1)

Liviu Uba
Liviu Uba

Reputation: 21

Found the solution. Put files in separate folders. Create a jsconfig.json file in each folder with content {}.

Upvotes: 1

Related Questions