TypeScript: augmenting built-in types
Types are ‘open ended’ in TypeScript, so you can just write: interface Array { shuffle: () => any; // <– Whatever signature you want. } And then the type is expanded to include the new function (and you can assign a function matching the signature to it). Note however that extending the built-in types (those … Read more