Public static
fields in TypeScript should be declared as readonly
to prevent them from being modified after their initial
assignment. This is a good practice because it makes the code safer by preventing accidental changes to these fields, which could lead to bugs that
are hard to detect.
class MyClass {
static myField = 42; // Noncompliant
}
To fix this, declare your static field with the readonly
qualifier.
class MyClass {
static readonly myField = 42;
}