-
Notifications
You must be signed in to change notification settings - Fork 55
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
Types are incorrect - lib returns undefined for unknown status codes #43
Comments
This feels kind of stage. @Retro64 is this a common practice ? Doesn't anyone with a good TS experience could validate ? |
Minimum example, why this might be dangerous:
Compiles properly, as test is typed as string, fails at runtime, as test is no string. Indicating it might be undefined leads to a warning it might not be defined during compile time. |
OK, I get it, thank you. Please prepare a PR. |
PR is open: #44 |
The library returns undefined for unknown status codes, which is not reflected in the types.
So I guess this would be a rather correct type:
For convenience - as the lib might quite often be used to trace foreign messages, where you might not rely on correct content - the types might even be extended (last lines to give concrete values priority) with:readonly [key: undefined]: undefinedorreadonly [key: unknown]: undefinedBut these are really optional and opinionated.I might provide a PR with the fix
and/or the feature, if it is acceptedThe text was updated successfully, but these errors were encountered: