tsoa: After update 6.1.5 Types of property 'successStatus' are incompatible
Sorting
-
I’m submitting a …
- bug report
- feature request
- support request
-
I confirm that I
- used the search to make sure that a similar issue hasn’t already been submit
Expected Behavior
After update from
{
"@tsoa/runtime": "^6.0.0",
"tsoa": "^6.0.4"
}
to
{
"@tsoa/runtime": "^6.1.5",
"tsoa": "^6.1.5"
}
running
tsoa spec-and-routes
I have this error:
\ts-node@10.9.2_@types+node@20.11.28_typescript@5.4.2\node_modules\ts-node\src\index.ts:859
return new TSError(diagnosticText, diagnosticCodes, diagnostics);
^
TSError: ⨯ Unable to compile TypeScript:
dist/routes.ts(880,42): error TS2379: Argument of type '{ methodName: string; controller: ProjectsController; response: ExResponse<any, Record<string, any>>; next: any; validatedArgs: any[]; successStatus: undefined; }' is not assignable to parameter of type 'ExpressApiHandlerParameters' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Types of property 'successStatus' are incompatible.
Type 'undefined' is not assignable to type 'number'.
dist/routes.ts(880,42)
templateService.apiHandler({
methodName: 'getProjects',
controller,
response,
next,
validatedArgs,
successStatus: undefined,
});
Context (Environment)
Version of the library: 6.1.5 Version of NodeJS: 20
- Confirm you were using yarn not npm: [ ]
Breaking change?
Yes, same code works with 6.0.0
About this issue
- Original URL
- State: open
- Created 3 months ago
- Comments: 16
@jackey8616 I have tried to override the interface with
types.d.ts
and works!The only fix for support
exactOptionalPropertyTypes
is makesuccessStatus?: number | undefined;