I am using angular-jwt to to check whether token is expire or not and while using i am getting this error
Type 'string' | null is not assignable to type 'string'
helper = new JwtHelperService();
var token: string = localStorage.getItem('token');
this.helper.isTokenExpired(token); // this line contains the error
Error


TypeScriptyou are using?nulland it therefore cannot be passed into the argument that does not accept a potential null value. Check if the value is null or not before passing it. Or, if it is null change it’s value to undefined.