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

[Visualizations] fix types on TS upgrade #16

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/plugins/charts/common/static/components/collections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const LabelRotation = Object.freeze({
Horizontal: 0,
Vertical: 90,
Angled: 75,
VerticalRotation: 270,
});
export type LabelRotation = $Values<typeof LabelRotation>;

Expand Down
11 changes: 5 additions & 6 deletions src/plugins/expressions/common/execution/execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,21 +420,20 @@ export class Execution<
: of(resolvedArgs);

return args$.pipe(
// @ts-expect-error upgrade to ts v4.7.4
tap((args) => this.execution.params.debug && Object.assign(head.debug, { args })),
tap((args) => this.execution.params.debug && Object.assign(head.debug ?? {}, { args })),
stratoula marked this conversation as resolved.
Show resolved Hide resolved
switchMap((args) => this.invokeFunction(fn, input, args)),
this.execution.params.partial ? identity : last(),
switchMap((output) => (getType(output) === 'error' ? throwError(output) : of(output))),
// @ts-expect-error upgrade to ts v4.7.4
tap((output) => this.execution.params.debug && Object.assign(head.debug, { output })),
tap(
(output) => this.execution.params.debug && Object.assign(head.debug ?? {}, { output })
),
switchMap((output) => this.invokeChain<ChainOutput>(tail, output)),
catchError((rawError) => {
const error = createError(rawError);
error.error.message = `[${fnName}] > ${error.error.message}`;

if (this.execution.params.debug) {
// @ts-expect-error upgrade to ts v4.7.4
Object.assign(head.debug, { error, rawError, success: false });
Object.assign(head.debug ?? {}, { error, rawError, success: false });
}

return of(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ interface LabelsPanelProps {
}

function LabelsPanel({ valueAxis, setValue, isNewLibrary }: LabelsPanelProps) {
// @ts-expect-error ts upgrade v4.7.4
const rotateLabels = valueAxis.labels.rotate === VERTICAL_ROTATION;

const setValueAxisLabels = useCallback(
Expand All @@ -44,7 +43,6 @@ function LabelsPanel({ valueAxis, setValue, isNewLibrary }: LabelsPanelProps) {

const setRotateLabels = useCallback(
(paramName: 'rotate', value: boolean) =>
// @ts-expect-error ts upgrade v4.7.4
setValueAxisLabels(paramName, value ? VERTICAL_ROTATION : 0),
[setValueAxisLabels]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';

import { SelectOption, SwitchOption } from '@kbn/vis-default-editor-plugin/public';
import { Labels } from '@kbn/charts-plugin/public';
import type { LabelRotation, Labels } from '@kbn/charts-plugin/public';

import { TruncateLabelsOption } from '../../common';
import { getRotateOptions } from '../../../collections';
Expand All @@ -34,8 +34,8 @@ function LabelOptions({
}: LabelOptionsProps) {
const setAxisLabelRotate = useCallback(
(paramName: 'rotate', value: Labels['rotate']) => {
// @ts-expect-error ts upgrade v4.7.4
setAxisLabel(paramName, Number(value));
const rotation = Number(value) as LabelRotation;
setAxisLabel(paramName, rotation);
stratoula marked this conversation as resolved.
Show resolved Hide resolved
},
[setAxisLabel]
);
Expand Down
Loading