angularjs - How to deal with spurious type script error: types of property $timeout of types base class and derived class are incompatible? -


since upgrading typescript 1.6, i've been getting appears spurious error ng.types:

typescript 1.6 class 'derivedclass' cannot extend class 'baseclass': types of property $timeout of types base class , derived class incompatible

here's code sample:

module app.test {      class derivedclass extends baseclass {         // notice there's nothing in derived class     }      class baseclass {         constructor(timeout: ng.itimeoutservice, val1: string, otherval: ng.ilogservice) {             var vm = this;             vm.$timeout = timeout;             vm.somevalue = val1;             vm.othervalue = otherval;         }         $timeout: ng.itimeoutservice; // angular.itimeoutservice works         somevalue: string;         othervalue: ng.ilogservice;     } } 

angular.itimeoutservice works, or adding import ng= angular; in modules works. didn't used issue in previous versions of typescript.

is best practice repeat alias (eg: import ng = angular) in each module before using it, though that's done in angular.d.ts?

is best practice repeat alias (eg: import ng = angular) in each module before using it, though that's done in angular.d.ts

no. error happening because have done this.

the code have posted works fine default:

enter image description here


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -