-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[FieldFormats] Reduce any
usage
#111530
[FieldFormats] Reduce any
usage
#111530
Conversation
bb9d392
to
7033024
Compare
@@ -828,7 +828,7 @@ export class SearchSource { | |||
body.query = buildEsQuery(index, query, filters, esQueryConfigs); | |||
|
|||
if (highlightAll && body.query) { | |||
body.highlight = getHighlightRequest(body.query, getConfig(UI_SETTINGS.DOC_HIGHLIGHT)); | |||
body.highlight = getHighlightRequest(getConfig(UI_SETTINGS.DOC_HIGHLIGHT)); |
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.
getHighlightRequest
didn't use query
inside, so I decided to remove it from the function signature to remove any
.
@lukasolson, could you review this one? Maybe this wasn't correct in the first place that query is not used inside getHighlightRequest
@@ -20,7 +20,7 @@ export class BoolFormat extends FieldFormat { | |||
}); | |||
static fieldType = [KBN_FIELD_TYPES.BOOLEAN, KBN_FIELD_TYPES.NUMBER, KBN_FIELD_TYPES.STRING]; | |||
|
|||
textConvert: TextContextTypeConvert = (value) => { | |||
textConvert: TextContextTypeConvert = (value: string | number | boolean) => { |
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.
For all of these formatters, I just specified types based on what I saw is supported in runtime
const fracSecMatchStr = fracSecMatch ? fracSecMatch[0] : ''; | ||
|
||
return { | ||
length: fracSecMatchStr.length, | ||
patternNanos: fracSecMatchStr, | ||
pattern, | ||
patternEscaped: fracSecMatchStr ? pattern.replace(fracSecMatch, `[${fracSecMatch}]`) : '', | ||
patternEscaped: fracSecMatchStr ? pattern.replace(fracSecMatchStr, `[${fracSecMatchStr}]`) : '', |
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.
return this.getDefaultInstanceMemoized(fieldType, esTypes, params); | ||
}; | ||
|
||
private getDefaultInstanceMemoized = memoize( |
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.
extracting memoized methods to not expose types from memoize publicly
Pinging @elastic/kibana-app-services (Team:AppServices) |
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.
Code changes LGTM, didn't test
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.
nice work!
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.
Code review only. Kibana vis editors team changes LGTM!
@elasticmachine merge upstream |
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.
Data Discover LGTM, just review, only types changed
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Public APIs missing comments
Any counts in public APIs
Public APIs missing exports
Page load bundle
History
To update your PR or re-run it, just comment with: |
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
Co-authored-by: Anton Dosov <[email protected]>
Summary
This reduces
any
usage in field formats code tackling lower hanging occurrencesThere is still a larger effort needed to improve types and get rid of
any
completely #108158. This needs more time to tackle (needs field formats public API change and then needs a bunch of downstream changes) and I am out of timeboxed time here already.