BuZZ-dEE
BuZZ-dEE

Reputation: 6929

Configure TSLint to show an error for static readonly name: 'some_string'

How to configure TSLint to show an error for the following code?

static readonly frame: 'frame';

The intention was to write:

static readonly frame = 'frame';

Upvotes: 0

Views: 216

Answers (1)

MoxxiManagarm
MoxxiManagarm

Reputation: 9124

I am not aware of any rule who does this. You could write a custom one tho.

After all I want to recommend you not to use static readonly fields in a typescript class. Please consider using a const in the ts file instead

const frame = 'frame';
// compiler would show an error on const frame: 'frame'

export class YourClass {
  // instead of static readonly frame = 'frame'
}

Upvotes: 0

Related Questions