How to typescript compatible method to native Array

I’ve created an add-on method to the native Javascript type "Array’ in .js file, which I include through index.html to ensure that it’s loaded into the runtime (I’m sure of this).


Array.prototype.myFunction = function (a,b,c) {


The problem is that I can’t get it recognized in the typescript compiler or in WebStorm. I know it has something to do with missing typing definitions, tsconfig, etc.

Can someone provide me the simple steps recipe for doing this. e.g. add file X, edit file Y. I both want the ionic compile to work and rid the syntax errors in WebStorm.


Not that you have any reason to care about my opinion, but the ability to modify prototypes of core language classes like Array is my single most-hated feature of JavaScript, because of how much confusion and unpredictability it can create. I would strongly recommend not messing with Array. If you must go down this road, how about making a MySuperArray class instead?