Fix type errors in formula.test.tsx
#176343
Labels
Feature:Lens
impact:medium
Addressing this issue will have a medium level of impact on the quality/strength of our product.
Team:Visualizations
Visualization editors, elastic-charts and infrastructure
technical debt
Improvement of the software architecture and operational architecture
Fix typescript type errors from #175178 removing
@ts-expect-error
comments.x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/formula.test.tsx
This error involves types that are a bit complex, a general approach in described below. See #176114 (review) for more details.
Here is a commit a20a96c with a start to the fix but is missing the correct
params
type.The mock function of
createOperationDefinitionMock
is trying to conform to multiple type definitions in a single function.I reworked the types to pass a generic type based on the
input
type, with it defaulting to thefield
type.This works for almost all cases, haven't checked other files 🤞🏼, except for used with the
label: 'moving_average'
, see next comment 👇🏼 .When defining the moving average definition like here...
kibana/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/formula.test.tsx
Lines 58 to 74 in a20a96c
The type of
params: { window: 5 }
is pointing to this type here thus why adding thewindow
prop fixes the error.But I think
window
type should be pulling fromMovingAverageIndexPatternColumn
instead which is here...kibana/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/moving_average.tsx
Lines 45 to 51 in a20a96c
The text was updated successfully, but these errors were encountered: