

You don’t need to install TypeScript in your project because WebStorm will use its bundled TypeScript version. For more about this see the WebStorm docs.
#Run npm install webstorm code
for React, you need to run npm install -save-dev own code completion will also benefit from adding the type definitions. They are available in the DefinitelyTyped repo and available on npm under the scope. If you’re using some libraries or frameworks, then, to provide relevant results, TypeScript will need to you install type definitions for the packages you use. To check only some files, we can add a // comment at the top of the file we want to check. To check all files, we need to add the "checkJs": true option to tsconfig.json – this will enable TypeScript for all JavaScript files in your project. Now we have to decide if we want to check all files by default, or only some files. This will allow TypeScript to check your JavaScript files. Now for the most important step: we need to add the option "allowJs": true to the compilerOptions property in tsconfig.json. To add a tsconfig.json file, you can use the New… action in the Project view and select tsconfig.json from the list. In TypeScript projects, the file also describes how the code should be compiled, but that’s not what we are interested in right now. In it, you can provide information about your project to TypeScript and specify what sort of checking you want to do. Tsconfig.json is a configuration file that TypeScript uses. Here’s how you can enable TypeScript in your JavaScript project, and see errors and warnings from it in WebStorm: Add a tsconfig.json file That allows the TypeScript language service (which you actually get when you run `npm install typescript`) to check your JavaScript code as if it were untyped TypeScript code. TypeScript is a superset of JavaScript (more precisely, of its latest specification, ECMAScript 2019). One more option that we’re going to talk about in this blog post is using TypeScript for checking your JavaScript code.

Second, you can see warnings and errors from linters like ESLint right in the editor.

There are several things WebStorm can do to help you find potential problems in your JavaScript code and improve its quality.įirst, there are dozens of smart built-in inspections that check your code as you type and offer various quick-fixes for the problems they detect.
