Skip to content

Fix constructor parameter properties violating erasableSyntaxOnly #151

Description

@Mosas2000

Description

Multiple error classes use constructor parameter properties (e.g., public code: string) which violates the erasableSyntaxOnly TypeScript compiler option enabled in the project.

Affected Files

  1. frontend/src/utils/oracleErrorHandling.ts (line 21)
  2. frontend/src/utils/errors.ts (line 6)
  3. frontend/src/utils/reputationErrors.ts (line 2)
  4. frontend/src/utils/performance.ts (line 115)

Current Pattern

constructor(message: string, public code: string) {
  super(message);
}

Why This Matters

The erasableSyntaxOnly option ensures that TypeScript syntax can be safely removed without changing runtime behavior. Constructor parameter properties are TypeScript-specific syntax that affects runtime behavior.

Proposed Solution

Refactor to explicit property declarations:

code: string;

constructor(message: string, code: string) {
  super(message);
  this.code = code;
}

Acceptance Criteria

  • Refactor all constructor parameter properties to explicit declarations
  • Ensure type checking passes
  • Verify all error classes work correctly
  • Update tests if needed

Priority

🟡 MEDIUM - TypeScript configuration compliance

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions