Creating Extension Methods Using Typescriptby@msarica
13,807 reads

Creating Extension Methods Using Typescript

January 8th 2020
2 min
by @msarica 13,807 reads
tldt arrow
EN
Read on Terminal Reader🖨️

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

@msarica

Mehmet

About @msarica
LEARN MORE ABOUT @MSARICA'S EXPERTISE AND PLACE ON THE INTERNET.
react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa