PyCharm supports developing and running TypeScript source code.
PyCharm 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.
To run, debug, and test your code you will need it translated into JavaScript which requires a transpiler
In this section:
- Make sure the JavaScript Support plugin is enabled. The plugin is bundled with PyCharm and activated by default. If the plugin is not activated, enable it on the Plugins page of the Settings dialog box as described in Enabling and Disabling Plugins.
-
Make sure the Node.js plugin is installed and enabled.
The plugin is not bundled with PyCharm, but it is available from the PyCharm plugin repository.
Once enabled, the plugin is available at the IDE level, that is, you can use it in all your PyCharm projects. See Installing, Updating and Uninstalling Repository Plugins and Enabling and Disabling Plugins for details.
-
Download and install the Node.js
framework.
-
Configure the Node.js interpreter in PyCharm:
- Choose Settings dialog box that opens, click Node.js and NPM under Languages&Frameworks. and in the
- On the Node.js page that opens, specify the location of the desired Node.js interpreter.
Coding assistance
TypeScript support includes:
- Code completion for keywords, labels, variables, parameters and functions.
- Error and syntax highlighting.
- Code formatting and folding.
- Numerous code inspections and quick-fixes.
-
Refactoring
- Common refactoring procedures, such as extract method , inline, rename/move, etc.
- TypeScript-specific refactoring procedures, such as change signature, extract parameter, extract variable. These types of refactoring are identical with JavaScript, for more details, see the section JavaScript-Specific Refactorings
-
Code generation
- Generating code stubs based on file templates during file creation.
- Ability to create line and block comments (Ctrl+Slash or Ctrl+NumPad //Ctrl+Shift+Slash or Ctrl+Shift+NumPad /).
-
Downloading stubs for TypeScript definition files
and configuring them as a PyCharm JavaScript library (see Configuring JavaScript Libraries).
-
Navigation and search through the source code:
- Navigating with Structure View.
- Ctrl+B, Ctrl+Button1 Click or Button2 Click). (
- Ctrl+Alt+B or Ctrl+Alt+Button1 Click) from overridden method / subclassed class. (
- Transpiling to JavaScript for further running, debugging, and testing, see Running TypeScript and Debugging TypeScript.
See Also
Language and Framework-Specific Guidelines:
External Links:
- https://github.com/Microsoft/TypeScript
- http://typescript.codeplex.com/
- https://npmjs.org/package/typescript
Web Resources: