84
rated 0 times
[
91]
[
7]
/ answers: 1 / hits: 79360
/ 7 Years ago, sun, august 13, 2017, 12:00:00
I'm trying to return a boolean after a promise resolves but typescript gives an error saying
A 'get' accessor must return a value.
my code looks like.
get tokenValid(): boolean {
// Check if current time is past access token's expiration
this.storage.get('expires_at').then((expiresAt) => {
return Date.now() < expiresAt;
}).catch((err) => { return false });
}
This code is for Ionic 3 Application and the storage is Ionic Storage instance.
More From » typescript