-
Notifications
You must be signed in to change notification settings - Fork 523
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
Upgrade query-string to v8.1.0 #1789
Conversation
Signed-off-by: Ansh Goyal <[email protected]>
Codecov ReportPatch coverage is 📢 Thoughts on this report? Let us know!. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes seem problematic to me. Just because some library returns a different result, you changes a lot of signatures in our code, expanding them to more states. Why do those states make sense on all those places? It reduces strong typing.
I would rather add a util function that wraps the library but returns the same [] signature as before. It doesn't make sense se introducing null everywhere.
Totally agree. I didn't think of the wrapper function approach at first. Thanks for that. Making the changes. However, doesn't the current approach seem more readable as the query-string's function signature matches with what we are expecting our function's parameters to be? |
there is a principle "be liberal in what you accept and conservative in what you send". Loosening the type of fields within structs breaks that principle because other places in the code that read the struct now must deal with bigger surface. On the other hand, loosening the type of function parameters seems to align with this principle, but it's not good either, especially in the existing code base. By loosening function signature when it was already tight and the existing code was already confirming to stricter type you are giving permission to that other code to be more sloppy about the typing. Implementation-wise, I don't have a strong opinion, it could be a helper function, or just |
Learning more daily 🚀 Thanks for the useful info. |
Superseded by #1794 |
….parse() (#1794) ## Which problem is this PR solving? - This PR upgrades the query-string dep from v6.3.0 to v8.1.0 - improved version of: #1789 - part of: #998 ## Description of the changes - In query-string v6.4.0, null type was introduced. sindresorhus/query-string@49d2203#diff-7aa4473ede4abd9ec099e87fec67fd57afafaf39e05d493ab4533acc38547eb8R36 - Further, in later versions, string[] type is changed to (string | null)[] - This PR adds a wrapper function for `queryString.parse()` function to modify its type as per our codebase. ## How was this change tested? - locally ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [x] I have added unit tests for the new functionality - [x] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `yarn lint` and `yarn test` --------- Signed-off-by: Ansh Goyal <[email protected]>
Which problem is this PR solving?
Description of the changes
null
type was introduced. sindresorhus/query-string@49d2203#diff-7aa4473ede4abd9ec099e87fec67fd57afafaf39e05d493ab4533acc38547eb8R36string[]
type is changed to(string | null)[]
How was this change tested?
Checklist
jaeger
:make lint test
jaeger-ui
:yarn lint
andyarn test