-
-
Notifications
You must be signed in to change notification settings - Fork 488
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
Numeric status codes #380
Comments
I've run into a similar problem. I worked around it by using a type map
I'd like that, too. I don't see a reason why the status code type should be a string |
I went ahead and prepared a PR for this change. |
I agree with this reasoning, and the PR at first glance looks great too. Will test it a bit more later tonight. Thank you! |
Hello, I really like this library but I had to fork it to be able to actually use it.
My issue is that the
responses
object lists the response status codes as strings. I need to be able to use numeric values in my codebase and I am not able to check them against the generated TS types.My solution was to replace the
{ [statusCode]: responseBodies }
object with a discriminated union:I can get a numeric enum from that simply by using
responses['statusCode']
.I've also noticed that TS allows actual numeric keys such as
{ 200: … }
(instead of{ "200": … }
) so that could be enough.Would such a change be acceptable? What is the actual reason the keys are strings anyway?
The text was updated successfully, but these errors were encountered: