Classes in typescript - 6thday of 100daysofcoding
Meet Vaghasiya
Passionate Vue.js & Laravel Developer | JavaScript Lover | Eager to Learn
Typescript is fully supported to work with modern javascript keyword class.
Generally, classes are blueprints to make properties and methods for objects. let's see how to define property and methods in the class. if you want some property then you have to add the constructor function, so when the class is initiated property is assigned to the instance. if you don't pass during assigning or forgot to assign, ts will give an error.
If there are any params in the method of a class or any return value, then we can use the same syntax as a normal function.
Extend method from other classes
Abstract class
we cannot initialize the abstract class. it's made to reusable some functionality. if we don't define the abstract method defined in the abstract class from children then it will give an error.