I had this TSLint error saying this:

TSLint: Type string trivially inferred from a string literal, remove type annotation(no-inferrable-types)

The code looked like this:

  public recentToken: string = '';

Solution

Because it is empty, you can set this differently. Some argue this is "clutter" from TypeScript, but it makes sense if you think about it.

  public recentToken!: string;

If you don't like this kind of TSLint stuff, set your configuration for the no-inferrable-types in your tslint.json file as

no-inferrable-types: false

 

Saved you some valuable time?

Buy me a drink 🍺