title: Calling splice on an extended Array causes an Error and I have no idea why
body: <p>When I call <code>Remove</code> in my class it throws an error when it comes to <code>this.splice</code>. Please note, <code>this.index</code> works fine. Do you have any idea why? And do you have a workaround?</p>
  <pre class="lang-cs prettyprint-override"><code>export class DefaultReorderableList&lt;T&gt; extends Array&lt;T&gt; implements ReorderableList&lt;T&gt; {
  
      constructor(items: Array&lt;T&gt;=[]) {
          super(...items);
          Object.setPrototypeOf(this, new.target.prototype);
      }
      
      Remove(item: T | ((element:T)=&gt;boolean) ): void {
          let index: number = -1;
          if(item instanceof ((element: T)=&gt; Boolean)){
              for(let i:number = 0, l:number = this.length; i&lt;l; i++){
                  let foo:(element:T)=&gt;boolean =item as (element:T)=&gt;boolean;
                  if(foo(this[i])){
                      index=i;
                  }
              }
          }
          index = this.indexOf(item as T);
          if (index &gt;= 0) {
              this.splice(index,1);
          }
      }
  
      SwapToPrevious(index: number): void {
          if(index == 0){
              return;
          }
          if(index &lt; 0 || index &gt;= this.length){
              throw new Error(&quot;Out of Range&quot;);
          }
          let indexedValue = this[index];
          this[index] = this[index -1];
          this[index-1]= indexedValue;
      }
  
  
      SwapToNext(index: number): void {
          if(index == 0){
              return;
          }
          if(index &lt; 0 || index &gt;= this.length){
              throw new Error(&quot;Out of Range&quot;);
          }
          let indexedValue = this[index];
          this[index] = this[index + 1];
          this[index + 1]= indexedValue;
      }
  
  }
  </code></pre>
  <p>Now in JavaScript you can run it here: <a href="https://jsfiddle.net/La3pqj1v/" rel="nofollow noreferrer">https://jsfiddle.net/La3pqj1v/</a></p>
  <pre><code>class DefaultReorderableList extends Array{
  
      constructor(items =[]) {
          super(...items);
          Object.setPrototypeOf(this, new.target.prototype);
      }
      
      Remove(item) {
          let index = -1;
          index = this.indexOf(item); // works
          if (index &gt;= 0) {
              this.splice(index,1); // does not work
          }
      }
  
      SwapToPrevious(index) {
          if(index == 0){
              return;
          }
          if(index &lt; 0 || index &gt;= this.length){
              throw new Error(&quot;Out of Range&quot;);
          }
          let indexedValue = this[index];
          this[index] = this[index -1];
          this[index-1]= indexedValue;
      }
  
  
      SwapToNext(index) {
          if(index == 0){
              return;
          }
          if(index &lt; 0 || index &gt;= this.length){
              throw new Error(&quot;Out of Range&quot;);
          }
          let indexedValue = this[index];
          this[index] = this[index + 1];
          this[index + 1]= indexedValue;
      }
  
  }
  
  let testClass = new DefaultReorderableList();
  testClass.push(&quot;a&quot;);
  testClass.push(&quot;b&quot;);
  
  console.log(testClass[0])
  testClass.SwapToPrevious(1); // works
  console.log(testClass[0])
  testClass.Remove(&quot;b&quot;); // does not work
  </code></pre>