paint-brush
Creating Extension Methods Using Typescriptby@msarica
16,406 reads
16,406 reads

Creating Extension Methods Using Typescript

by Mehmet2mJanuary 8th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow
EN

Too Long; Didn't Read

Creating Extension Methods Using Typescript using decorators. C#'s extension method feature is a work around. We are adding the the function to the prototype of the passed in class. This trick will not work on most third party libraries assuming that they are safeguarded against prototype pollution. The beauty of extension methods is that it should work on classes that we don't have any control over. So this trick won't work on the most third-party libraries. (https://stackblitz.com/cms/TypeScript/issues/9)

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Creating Extension Methods Using Typescript
Mehmet HackerNoon profile picture
Mehmet

Mehmet

@msarica

msarica.com

About @msarica
LEARN MORE ABOUT @MSARICA'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Mehmet HackerNoon profile picture
Mehmet@msarica
msarica.com

TOPICS

Languages

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite