CLion 2017.3 Help

TypeScript

File | Settings | Languages and Frameworks | TypeScript for Windows and Linux
CLion | Preferences | Languages and Frameworks | TypeScript for macOS
Ctrl+Alt+S /help/img/idea/2017.3/settings.png


In this dialog:

  • Choose whether you want to use the TypeScript Language Service or to get coding assistance from CLion only.
  • Activate, deactivate, and configure the behaviour of the built-in TypeScript compiler.

ItemDescription
Node interpreter In this field, specify the location of the Node.js executable file. In most cases, CLion detects the Node.js executable and fills in the field automatically.
TypeScript From this drop-down list, choose the version of the compiler to use (CLion displays the currently chosen version):
  • Bundled: if you choose this option, CLion uses it without attempting to find another typescript package.
  • Select:
  • Detect: if you choose this option, CLion searches for a typescript package in the current project. If a typescript package is found, CLion uses it. Otherwise the default bundled package is used. This option is chosen by default.
  • Custom directory: choose this option to use a custom version of the compiler. In the text box, specify the location of the typescriptServices.js, lib.d.ts, and lib.es6.d.ts files downloaded from https://github.com/Microsoft/TypeScript/.
TypeScript Language Service Select this checkbox to get native support from the TypeScript Language Service according to the up-to-date specifications. As a result:
  • Syntax and error highlighting is based on the annotations from the TypeScript Language Service.
  • Completion lists contain both suggestions from the TypeScript Language Service and suggestions calculated by CLion. To get only suggestions from CLion, click Configure and clear the Code completion checkbox in the Service Options dialog that opens.

CLion supports integration with the Angular language service developed by the Angular team to improve code analysis and completion for Angular-TypeScript projects. Note that the Angular language service works only with the projects that use Angular 2.3.1 or higher and TypeScript version compatible with it. The Angular language service is activated by default so CLion starts it automatically together with the TypeScript service and shows all the errors and warnings in your TypeScript and HTML files both in the editor and in the TypeScript Compiler Tool Window. However if you still need to activate the service, select the Angular Language Service checkbox.

In the Default options field, specify the command line options to be passed to the compiler when the tsconfig.json file is not found. See the list of acceptable options at TSC arguments. Note that the -w or --watch (Watch input files) option is irrelevant.

Recompile on changes
  • When this checkbox is selected, the built-in compiler "wakes up" upon any change to a TypeScript file.
  • When this checkbox is cleared, the built-in compiler ignores changes to TypeScript files. To re-activate the compiler, open the TypeScript Compiler Tool Window (View | Tool Windows | TypeScript Compiler), and click the Compile All button icon_ts_compile_all on the toolbar.

    If you have not opened the TypeScript Compiler Tool Window yet and it is not available from the View menu, choose Help | Find Action, then find and launch the TypeScript Compile All action from the list.

Compile scope From this drop-down list, choose the scope to apply the compiler in. The available options are:
  • Project Files: all the files within the project roots.
  • Open Files: all the files that are currently opened in the editor.
Alternatively, click the Browse button and configure a custom scope in the Scopes dialog box that opens. For more details on scopes, see Scopes dialog.
Use tsconfig.json Choose this option to have the built-in compiler analyze the code according to the settings specified in the tsconfig.json file. When you open a project, CLion starts searching for a tsconfig.json file in it. If a tsconfig.json file is found, the compiler uses the options specified in it. Otherwise an error is reported.
Last modified: 24 October 2017

See Also