Context actions for TypeScript
warning
Starting from ReSharper 2022.2, active development of productivity features for JavaScript, TypeScript, JSON, CSS, and Protobuf is suspended, and these features are disabled by default. To enable them, select the corresponding checkboxes on the Environment | Products & Features page of ReSharper options Alt+R, O: JavaScript and TypeScript, CSS Language, and Protobuf.
ReSharper provides the following context actions for TypeScript:
Name | Description |
---|---|
Change visibility modifier | Changes visibility of class and module members |
Convert field to parameter-property | Introduces parameter-property declared as a constructor parameter from class field |
Convert 'if' to 'switch' for enums | If a variable is subsequently checked in 'if's with enum values, replaces 'if' with a 'switch' |
Convert member assigned by a lambda expression to function member | Type member, which is assigned by a lambda expression, generally may be converted to function member. Not guaranteed to work correctly if you have implicit method invocations via 'apply'. |
Convert parameter-property to field | Introduces field from parameter-property declared in constructor |
Create derived type | Creates class that implements interface or inherits class |
Create from Usage | Creates class, interface, enum, module, member function, or member property from usage For more information, refer to generate code from usage. |
Create overload without parameter | Creates overload signature with an absence of specified parameter. Subsequent parameters in the main signature may be marked as optional if needed. |
Create paired accessor | Creates paired accessor for currently implemented one |
Dotted name to nested module | Creates nested module for dotted name segment. For example, converts 'module A.B.C' to 'module 'A.B' with nested module 'C'. |
Import type or type element | Imports modules, classes, variable, interfaces, enums declared somewhere else |
Inline type alias | Inlines a type alias, i.e. replaces its usages with the corresponding type and removes the type alias declaration |
Introduce type alias | Introduces a new type alias for selection |
Match file name with type name | Renames current file to match the name of the only top-level type declared therein |
Move type to another file to match its name | Moves current type to another file so that its name matches the name of the type |
Nested module to dotted name | Merges nested single exported module as dotted name. For example, converts 'module A.B' with nested exported 'module C' to 'module A.B.C'. |
Replace alias with qualifier | Replaces alias with fully qualified name |
Specify return type explicitly | Specifies function return type explicitly if it may be derived from returned values |
Specify type explicitly | Specify variable type explicitly for declaration with assignment |