TypeScript doesn’t support extension methods.
The @x9_extension
JSDoc annotation lets you “tag” functions that are meant to be used as extensions methods for a particular type.
This information is later used by the IDE to include these “extension methods” in relevant autocomplete scenarios.
For example:
// string_utils.ts/** * @x9_extension */function shout(str: string) { return `${str}!`;}
Now every time you trigger autocomplete on a string value, you’ll see shout()
listed alongside .toString()
, .toUppercase()
, etc.
Notes: