As we already know, TypeScript allows us to use features of the upcoming ECMAScript specifications. TypeScript uses a series of helper functions to implement some of these features at runtime. The following are some of the helper functions generated by TypeScript:
- __extends for inheritance
- __assign for object spread properties
- __rest for object rest properties
- __decorate, __param, and __metadata for decorators
- __awaiter and __generator for async/await
If one of these helpers is required, TypeScript will generate it at compilation time. However, this can be a problem, because the helper is generated in all of the files that require it, which can lead to a lot of duplicated code.
We can use the following ...