Category: TypeScript

Using Short Imports in TypeScript

When importing modules (e.g. classes, interfaces, etc) in TypeScript, the most common method is to allow the IDE to create a relative import statement. Here is an example:

However, there is an easy way to completely avoid these long import statements. All it requires is some simple and minor modifications to your tsconfig.json file.
Read more…

Guide to Extract Method Refactoring in TypeScript

The purpose of the extract method refactoring is to turn a section of code into a new method. The method should be given a name that accurately describes the purpose of the extracted section of code. Extracting methods allows the code to be self documenting and also allows the code to be reused elsewhere thereby reducing duplication.

Read more…