Friday, May 18, 2018

Learn About Extension Methods In TypeScript

Extension-method gives you the power to add new methods to existing types. You don’t have to create a new derived-type. You can write extension-method of any data-type you want. It’s just like writing a simple function of a specific class. These are static methods. We can extend any class or interface to write our own extension-method but remember, we cannot override the existing ones. Even if we have the same name and signature of our own extension-method as of the existing one, then our method cannot be called in any case. So, make sure that whenever you write your extension-method, name and signature should differ from the existing ones.

source https://www.c-sharpcorner.com/article/learn-about-extension-methods-in-typescript/

No comments:

Post a Comment