Skip to content

TS [5.2] Use override in Class Methods for Type Safety #218

@MaryamAdnan3

Description

@MaryamAdnan3

TS Version: 5.2
override keyword enforcement, stricter method declarations

Affected Files:

  • abortError.ts
  • apiError.ts
  • argumentsValidationError.ts
  • responseValidationError.ts

Problem:
Currently, overridden methods in classes do not explicitly use override, making refactoring error-prone.

Proposed Solution:
Add the override keyword to methods that are intended to override a base class method.

Example Fix (abortError.ts):

class AbortError extends Error {
  constructor(message: string, cause?: unknown) {
    super(message, { cause });
    this.name = "AbortError";
  }
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions