Skip to content

ESLint only-throw-error complains on subclasses #31

@unlight

Description

@unlight

Guidelines

  • Please search other issues to make sure this bug has not already been reported.

Describe the bug

ESLint rule https://typescript-eslint.io/rules/only-throw-error/ complains about derived classes

const RecipeError = BaseError.subclass('RecipeError', {
  props: { recipeId },
});
throw new RecipeError('Add failed:'); // <--- ESLint plugin: Expected an error object to be thrown

Looks like typescript-eslint plugin thinks that variable is not inherited from Error

image

Steps to reproduce

See 'Describe the bug'

Environment

"@eslint/js": "^9.12.0"
"typescript-eslint": "^8.8.0"

Pull request (optional)

  • I can submit a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions