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.
In this topic:
Live Templates
Live templates represent code fragments that can be quickly inserted into your code. The code of the template can be a short expression, a complete construct, or even an entire class or method. Each live template is identified by a Shortcut - a short string of characters such as foreach - that you can type right in the editor to invoke the template. For more information, see Creating Source Code Using Live Templates.
ReSharper provides plenty of predefined live templates. You can also create custom live templates in the dedicated editor or right from existing source code.
Surround Templates
Surround templates
let you quickly enclose an expression, a single statement or an arbitrary
block of code with a predefined code construction, such as
for
loop, or
try...catch
statement.
Surround templates have no shortcuts, they are identified by their descriptions.
See
Surrounding Code Fragments with Templates
for details.
There are a few predefined surround templates. You can also create your own surround templates.
File Templates
File templates are used to create one or more new files with predefined code, such as a type declaration, unit test, etc. File templates have no shortcuts, they are identified by their descriptions. See Creating Files from Templates and Creating 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.
There are predefined templates for file, class, interface, and module. You can also create new file and multi-file templates.