117
rated 0 times
[
118]
[
1]
/ answers: 1 / hits: 33700
/ 12 Years ago, sat, december 22, 2012, 12:00:00
Is there any way to inherit a class from JS native function?
For example, I have a JS function like this:
function Xarray()
{
Array.apply(this, arguments);
//some stuff for insert, add and remove notification
}
Xarray.prototype = new Array();
I tried to convert it to Typescript but i failed!!
export class Xarray implements Array {
}
The compiler asks me to define all Array
interface properties. I know if I need this Xarray.prototype = new Array();
, I have to extend Array
in TS.
How to extend the JS native object in TS?
More From » typescript