-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG][typescript-fetch] New FetchError class incorrectly extends base class Error #12927
Comments
Hey @orange-buffalo, since you designed FetchError I was wondering if you can think of a solution. Thank you in advance! |
I had this very issue because I had Removing |
Th current code for export class FetchError extends Error {
name: "FetchError" = "FetchError";
constructor(public cause: unknown, msg?: string) {
super(msg);
}
} As far as I can see, it is compliant with ES5 definition: interface Error {
name: string;
message: string;
stack?: string;
} (probably this is the reason I missed it during implementation, as I transpile to ES5). However, in newer versions the definition changes: interface Error {
cause?: Error;
} Which seems to be clashing with My suggestion would be to align CC @macjohnny |
@orange-buffalo can you file a PR? |
#13004. I decided to go with the minimal changes. Checked the samples build with es5 and esnext, both passed. |
Bug Report Checklist
Description
3a2bbbb introduced a new class (FetchError) that produces a build issue in TypeScript when using the strict mode:
Example of FetchError:
openapi-generator/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts
Lines 239 to 244 in 8d62e59
openapi-generator version
v6.0.1 (and master)
OpenAPI declaration file content or url
N/A
Generation Details
N/A
Steps to reproduce
N/A
Related issues/PRs
FetchError was introduced in the context of this issue: #12716.
Suggest a fix
N/A
The text was updated successfully, but these errors were encountered: