This member must have an 'override' modifier because it overrides a member in the base class 'Error'.
See original GitHub issueHi,
When I generate the Typescript Api Services from a C# API, I have an issue with Exception class generated by NswagStudio:
export class ApiException extends Error {
message: string; //here is the error
status: number;
response: string;
headers: { [key: string]: any; };
result: any;
constructor(message: string, status: number, response: string, headers: { [key: string]: any; }, result: any) {
super();
this.message = message;
this.status = status;
this.response = response;
this.headers = headers;
this.result = result;
}
protected isApiException = true;
static isApiException(obj: any): obj is ApiException {
return obj.isApiException === true;
}
}
Here is my configuration in NswagStudio for the exception
Version:

And the error :
Error: src/app/services/api/api.services.ts:1915:5 - error TS4114: This member must have an ‘override’ modifier because it overrides a member in the base class ‘Error’.
1915 message: string; ~~~~~~~
I can’t see any option about that in nswag studio. As the file is automatically generated, I would like to avoid to modifiy the typescript api services files each time the file is updated.
Is there a specific option to fix the issue?
Thanks
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Tip #32[TS override keyword]
This member must have an 'override ' modifier because it overrides a member in the base class … It prevents you from accidentally...
Read more >Why protected members can be overridden by public ...
It's private ; if the base class wanted you to have access to the field, they would have made it protected , after...
Read more >Documentation - TypeScript 4.3
This member cannot have an 'override' modifier because it is not declared in the base class 'SomeComponent'.
Read more >typescript: override parameter properties syntax is not ...
If this option is active, all methods and properties which override a similar method/property in the base class are forced to have the...
Read more >Introducing Typescript `override` keyword
As the top quote explains, the override keyword will assert that the function it describes is present in the parent class.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You need to use
"typeScriptVersion": 4.3in your nswag configuration for theoverridekeyword to be generated.The issue is already known since novembre 2021. => https://github.com/RicoSuter/NSwag/issues/3685
Here, many people are waiting for it resolution.