December 2017
Beginner
372 pages
10h 32m
English
By default, the class decorators in TypeScript do not override the constructors, but add logic on top of the constructor implementation. But, there are instances where we would like to have a decorator that overrides the existing constructor and returns a new constructor implementation. This is where TypeScript excels. The syntax of the decorator that overrides the current implementation of the constructor is very similar to the syntax we have been looking at in the earlier sections, with the main difference in the type that is returned from the decorator.
The following is the syntax of a class decorator that replaces the constructor of the class with a new constructor:
The preceding code is for the ...
Read now
Unlock full access