Skip to content
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

Type improvements #12

Conversation

flash1293
Copy link

The PR looks good to me, I just had a bad feeling about some of the type casts - these can hide problems later when touching this code again. I went through the non-test files and tries to get rid of them.

if (interval) {
if (date) {
const { intervalESUnit, intervalESValue } = params as DateHistogramParams;
if ('interval' in params) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is simpler than casting 😄.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most important it's safer because Typescript infers the correct type on its own 🙂

@maryia-lapata maryia-lapata merged commit d7e5043 into maryia-lapata:agg-response-cleanup Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants