JetBrains Rider 2017.2 Help

TypeScript

JetBrains Rider supports developing and running TypeScript source code. JetBrains Rider recognizes *.ts files and provides full range of coding assistance for editing them without any additional steps from your side. TypeScript files are marked with the ac iconFileType TypeScript icon.

Before you start

    On this page:

    TypeScript-aware 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.

    Parameter hints and type information

    Parameter hints show the names of parameters in methods and functions to make your code easier to read. To see the inferred type for an object, hold on macOS or Ctrl on Windows and Linux and hover the mouse pointer over it:

    ws_typescript_parameter_hints

    By default parameter hints are shown only for values that are literals or function expressions but not for named objects.
    To show parameter hints for all arguments

    1. Open the Appearance page (File | Settings | Editor | General | Appearance for Windows and Linux or JetBrains Rider | Preferences | Editor | General | Appearance for macOS).
    2. Click Configure next to the Show parameter name hint check box (the check box is selected by default).
    3. In the Configure Parameter Name Hints dialog that opens, select the Show name for all arguments check box in the Options area.

    Configuring TypeScript coding assistance

    TypeScript-specific coding assistance can be provided either by JetBrains Rider itself or based on the data from the TypeScript Language Service.

    To configure coding assistance for TypeScript

    1. Open the TypeScript page (File | Settings | Languages and Frameworks | TypeScript for Windows and Linux or JetBrains Rider | Preferences | Languages and Frameworks | TypeScript for macOS).
    2. Select the Use TypeScript Service check box 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 JetBrains Rider. To get only suggestions from JetBrains Rider, click Configure and clear the Code completion checkbox in the Service Options dialog that opens.
    3. 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.

    Common and TypeScript-specific refactoring

    • Common refactoring procedures, such as extract method, inline, rename/move, etc.
    • TypeScript-specific refactoring procedures, such as change signature, extract parameter, extract variable.

    See also Refactoring JavaScript.

    Code generation

    • Generating code stubs based on file templates during file creation.
    • Ability to create line and block comments (Ctrl+Alt+//Ctrl+Shift+/).
    • Generating import statements for modules, classes, and any other symbols that can be exported and called as a type.
    • Configuring automatic insertion or skipping the public access modifier in generated code.

    Compilation into JavaScript

    Compiling TypeScript into JavaScript for further running, debugging, and testing, see Compiling TypeScript to JavaScript for details.
    Last modified: 27 December 2017