Getting an error message when compiling typescript -


i have following piece of code:

class basketmanager {     private persistpromises: { [key: string]: ng.ipromise<basket.basketmodel> } = {};      constructor(private $q: ng.iqservice) {}      order(basket: basket.basketmodel, simulate = false): ng.ipromise<basket.basketmodel> {         return this.persistpromises[basket.basketid] = this.$q.when(this.persistpromises[basket.basketid] || basket).then(basket => {             return this.$http.post(url, {})                 .then((response:ng.ihttppromisecallbackarg<api.contracts.ibasketcontract>) => this.storebasket(response.data, true))                 .catch((response:ng.ihttppromisecallbackarg<any>) => this.handlebasketerrorresponse(basket, response));         });     });      private storebasket(data: api.contracts.ibasebasketcontract, withitems = false): basket.basketmodel {         /* ... */     }      private handlebasketerrorresponse(basket: basket.basketmodel, response: ng.ihttppromisecallbackarg<any>): basket.basketmodel {         /* ... */     } } 

when try compile it, error message:

typescript error: app/scripts/objectmanager/basketmanager.service.ts(100,60): error ts2453: type argument type parameter 'tresult' cannot inferred usage. consider specifying type arguments explicitly.   type argument candidate 'ibasebasketcontract' not valid type argument because not supertype of candidate 'basketmodel'. 

100,60 7,56 in above snippet.

i tried explicitly specifying arguments each , every variable, didn't help. missing?

ok, looks found answer myself. replaced line error this:

return this.persistpromises[basket.basketid] = this.$q.when(this.persistpromises[basket.basketid] || basket).then<basket.basketmodel>(basket => { 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -