TS2415 Error Class 'ObservableArray' incorrectly extends base class 'ArrayBase'

Posted by: parmarav on 1 November 2017, 6:57 pm EST

    • Post Options:
    • Link

    Posted 1 November 2017, 6:57 pm EST

    Hi Team,

    While upgrading Wijmo from the currently used version in my application http://prerelease.componentone.com/wijmo5/npm-images/C1Wijmo-Enterprise-Eval-System-5.20171.300.tgz to latest version http://prerelease.componentone.com/wijmo5/npm-images/C1Wijmo-Enterprise-Eval-System-5.20173.371.tgz, I am running into some typescript errors as below:-

    /node_modules/wijmo/wijmo.d.ts(388,22): error TS2415: Class 'ObservableArray' incorrectly extends base class 'ArrayBase'.
      Types of property 'splice' are incompatible.
        Type '(index: number, count: number, item?: any) => any[]' is not assignable to type '{ (start: number): any[]; (start: number, deleteCount: number, ...items: any[]): any[]; }'.
    

    Can you please let me know what needs to be done ?

    Thanks

    Anshul Parmar

  • Posted 2 November 2017, 4:47 pm EST

    Hi Anshul,

    We are sorry, we are unable to replicate the issue at our end with the same build. Please refer to the attached sample for the same.

    ~Manish

  • Posted 2 November 2017, 4:48 pm EST

  • Posted 3 January 2018, 3:04 am EST

    I get the same error running it in Angular 2.0.0. We are upgrading from 20171.282 to 20173.380.

    Build: Wijmo-Enterprise.20173.380.zip

    Thanks,

    Senthur

  • Posted 3 January 2018, 4:53 pm EST

    Hi Senthur,

    Could you please share the following information with us?

    -The wijmo module that you are using in your project (AMD,CommonJS,SystemJS)

    -Typescript version for you project and machine

    -Project type (created using Angular CLI/ SystemJS)

    It would be helpful, if you might share the demo sample depicting the issue at our end.

    ~Manish

  • Posted 19 February 2018, 7:50 am EST

    I got this error too. I found that it’s conflicting with a custom .d.ts file of mine that “extends” Array. If I comment out the remove declaration in my .d.ts file, then I’m able to compile.

    
    interface Array<T> {
        remove(predicate: (item: T, index: number) => boolean): T[];
    }
    
    

    Which corresponds to this:

    
    
     Array.prototype.remove = function (predicate) {
                let i = this.length;
                let returnArray = [];
    
                while (i--) {
                    if (predicate(this[i], i)) {
                        returnArray = this.splice(i, 1);
                    }
                }
    
                return returnArray;
            };
    

    Wonder if you can suggest an alternate way for me to define my Array.remove function and still work with wijmo.d.ts (which is where the error is coming from).

  • Posted 19 February 2018, 10:59 pm EST

    Hi,

    We are looking into this

    ~Manish

  • Posted 21 February 2018, 12:15 am EST

    Hi,

    Array.prototype.remove = function (predicate) {

    let i = this.length;

    let returnArray = ;

            while (i--) {
                if (predicate(this[i], i)) {
                    returnArray = this.splice(i, 1);
                }
            }
    
            return returnArray;
        };
    

    Currently, above approach is appropriate approach.

    ~Manish

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels