Code Templates in TypeScript
Most of ReSharper's code template features are also supported in TypeScript. You can find the detailed information on these features in the corresponding topics of the Code templates section.
Live/Surround templates can be used for generating code in existing files and (if there is the
$SELECTION$ parameter in the template body) for surrounding code fragments with template code, such as
Each live template is identified by a Shortcut — a short string of characters, for example
foreach — that you can type right in the editor to invoke the template.
File templates are used to create one or more new files with predefined code, such as a type declaration, unit test, and so on. File templates have no shortcuts, they are identified by their descriptions. See Create files from templates and Create Multi-File Templates for details.
A file template can create more than one file when you apply the template. This may be helpful when related data is saved in different files.
Postfix templates help you transform expressions that you have already typed without jumping backwards — just type a dot after an expression and pick a template from the completion list.
Below is the list of postfix templates available in TypeScript.
Checks boolean expression to be 'false'
Iterates over an iterable object
Checks boolean expression to be 'true'
Checks instance of expression
Checks expression to be not-null
Checks expression to be not-undefined
Checks expression to be null
Returns expression from current function
Checks type of expression
Checks expression to be undefined
Introduces variable for expression