ReSharper 8.0 Web Help

Code highlighting

ReSharper recognises *.ts and *.d.ts files, and highlights source code within such files according to the predefined colors. You can change colors and fonts at any time. For more information, see Configuring Syntax Highlighting.

Code completion

As usual, you can use Code completion features to ease code writing. TypeScript is an object-oriented programming language, so we can define types and members. For example, ReSharper suggests members of the current instance after this keyword.
ReSharper also takes into account the right level of abstraction. Consider the example below. After a new instance of the Vector object is initialized, ReSharper displays all available members in the completion list.
The minus and plus methods are public, so they are in the list. The times method is private, so it is excluded from the list.


ReSharper suggests about 50 quick-fixes to fix compiler errors.

Rename function overload properly
It is a small handy fix. If you have made a typo or two in a function name, ReSharper highlights the suspicious name and suggests you the corresponding quick-fix. After applying the quick-fix, your function overloads will be properly and accurately declared.

Make public/private
The default member accessibility is public, but if you explicitly specify a function as private, then all its overloads should have the same modifier. If it is not so, ReSharper highlights that and suggests changes.

Add type annotation
When type is not specified, the variable is highlighted. Press Ctrl+Enter to display the list of quick-fixes and apply the following one. Necessary type annotation will be added.

Remove question mark
In TypeScript optional parameters can't have default values. If they by accident have, you can either remove a question mark or remove the initializer.

Remove ambient function body
There is no need to keep unnecessary constructs in your code. In attempt to make code readable, ReSharper suggests removing ambient function bodies, for example.

Context actions

Create from usage
You can create declarations of symbols after they have been actually used via the corresponding context action.
Or you can use a data type that doesn't exist yet and declare it later using the following context action.

Import type
In some other cases, there is no need to create a new entity. When, for example, you want to use an existing one and the only thing that you you haven't taken into account yet is visibility scope.