Extending built-in types in Typescript JSDoc

33 Views Asked by At

I would like to define one single function that would need to be available to every single value of every single type in the program (so, basically, on Object.prototype).

I know that this is generally considered evil and I don't care ;)

// Just like this, but in JSDoc, WITHOUT having to create a d.ts file.
// I've tried so many different approaches from the internet and nothing seems to work.
declare global {
  interface Object {
    myFunc(): void;
  }
}
0

There are 0 best solutions below