Closed
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
export class HttpErrorResponse implements Error {
readonly name = "HttpErrorResponse";
readonly message: string;
readonly error: any | null;
readonly ok = false;
constructor(public status: number) {}
}
function test() {
throw new HttpErrorResponse(404);
}
test();
ESLint Config
module.exports = {
parser: "@typescript-eslint/parser",
rules: {
"@typescript-eslint/only-throw-error": "error"
},
};
tsconfig
Expected Result
I would expect an error is not detected
Actual Result
Expected an error object to be thrown. 11:9 - 11:35
Additional Info
The code of the linked playgroung is copied from angular type declarations. It seems angular is implementing instead of extending the Error interface for their HttpErrorResponse and that eslint is not recognising this. AFAIK rule should not trigger an error as thrown object is implemeting the Error interface.