In this section:
WebStorm supports developing and running TypeScript source code. WebStorm recognizes
*.ts files, and allows you to edit them providing full range of coding assistance without any additional steps from your side. TypeScript files are marked with the icon.
Preparing for TypeScript development
TypeScript support includes:
- Coding assistance:
- Code completion for keywords, labels, variables, parameters, and functions.
- Error and syntax highlighting.
- Code formatting and folding.
- Numerous code inspections and quick-fixes.
This assistance can be provided either by WebStorm itself, or based on the data from the TypeScript Language Service. Provision of coding assistance is configured on the TypeScript page of the Settings / Preferences Dialog:
- Select the Use TypeScript Service check box to get native support from the TypeScript Language Service according to the up-to-date specifications. In this case, syntax and error highlighting is performed based on the annotations retrieved from the TypeScript Language Service while code completion lists contain both suggestions from the TypeScript Language Service and suggestions calculated by WebStorm itself. To get only suggestions from WebStorm, click Configure and clear the Code completion check box in the Service Options dialog box that opens.
In the Default options field, specify the command line options to be passed to the compiler when the
tsconfig.jsonfile is not found. See the list of acceptable options at TSC arguments. Note that, the
--watchoption (Watch input files) is irrelevant.
- Common refactoring procedures, such as extract method , inline, rename/move, etc.
- TypeScript-specific refactoring procedures, such as change signature, extract parameter, extract variable.
- Code generation
- Generating code stubs based on file templates during file creation.
- Ability to create line and block comments (Ctrl+Slash/Ctrl+Shift+Slash).
importstatements for modules, classes, and any other symbol that can be exported and called as a type, see Creating Imports, section Importing TypeScript Symbols.
- Configuring automatic insertion or skipping the public access modifier in generated code.
- Navigation and search through the source code:
- Navigating with Structure View.
- (Ctrl+Alt+B) from overridden method / subclassed class.