This is fairly simple:
# this gets understood correctly
responses:
200: { description: "OK" }
400: { description: "Bad Syntax" }
# this doesn't
responses:
200: { description: "OK" }
4XX: { description: "Error" }
# (imagine that the 400/4XX codes returned a schema named `ApiError`)
The return types of functions will, example, should be like this:
But instead, 4XX will be understood as a "success", so it'll actually generate a type like this:
ApiResponse<ApiError>
// or, if the function should return something:
ApiResponse<SomeReturnData | ApiError>