regexFind: /readonly\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/
regexReplace: $1(Remove 'readonly' modifier from method declaration. The 'readonly' modifier can only be used on properties and index signatures.
class MyClass {
- readonly method() {
+ method() {
return 'test'
}
}Explanation: Remove readonly modifier from method declaration
class DataClass {
- readonly process() {
+ process() {
return 'data'
}
}Explanation: Readonly modifier cannot be used on methods
npx tsc ./docs/1024/index.ts --noEmit --prettydocs/1024/index.ts:2:3 - error TS1024: 'readonly' modifier can only appear on a property declaration or index signature.
2 readonly method() {
~~~~~~~~OR (without --pretty flag):
docs/1024/index.ts(2,3): error TS1024: 'readonly' modifier can only appear on a property declaration or index signature.