TypeScript Version: 1.8.10 and nightly (2.1.0-dev.20160804)
Code
/// <reference path="typings/globals/core-js/index.d.ts" />
export class CryptoService
{
static getToken()
{
return Promise.resolve('123');
}
static setXsrf()
{
return this.getToken.then( token => {} );
}
}
Not expected error:
error TS2339: Property 'then' does not exist on type '() => Promise
'.
You wanted to write this.getToken() (notice the ()) right?
@DickvdBrink, you say that I can not get a token?
Change:
return this.getToken.then( token => {} );
to
return this.getToken().then( token => {} );
Thank you guys! I am ashamed =)
Unless you have reason to believe there's actually a compiler bug, please use Stack Overflow for questions or log an issue with the definition file. Thanks!
Most helpful comment
Unless you have reason to believe there's actually a compiler bug, please use Stack Overflow for questions or log an issue with the definition file. Thanks!