Skip to content

Latest commit

 

History

History
54 lines (42 loc) · 1.22 KB

File metadata and controls

54 lines (42 loc) · 1.22 KB

1044 - '{0}' modifier cannot appear on a module or namespace element.

🔍 Regex Patterns

regexFind: /(public|private|protected|static|async|readonly)\s+(const|let|var|function|class|interface|type)/
regexReplace: $2

💡 Suggestion

Remove accessibility modifier from module or namespace element. Modules and namespaces cannot have accessibility modifiers like public, private, or protected.

📝 Examples

Example 1: Public modifier in module

module TestModule {
-  public const value = 42
+  const value = 42
}

Explanation: Remove public modifier from module element

Example 2: Private modifier in namespace

namespace MyNamespace {
-  private function helper() {}
+  function helper() {}
}

Explanation: Remove private modifier from namespace element

🖼️ Visual Output

Command

npx tsc ./docs/1044/index.ts --noEmit --pretty

Result

docs/1044/index.ts:2:3 - error TS1044: 'public' modifier cannot appear on a module or namespace element.

2   public const value = 42
    ~~~~~

OR (without --pretty flag):

docs/1044/index.ts(2,3): error TS1044: 'public' modifier cannot appear on a module or namespace element.