Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniil Suleiman committed Mar 2, 2021
1 parent 2ede9f0 commit e9a4409
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { PersistedState } from 'src/plugins/visualizations/public';
// @ts-expect-error
import { ErrorComponent } from './error';
import { TimeseriesVisTypes } from './vis_types';
import { TimeseriesVisParams } from '../../metrics_fn';
import { TimeseriesVisParams } from '../../types';
import { TimeseriesVisData } from '../../../common/types';

interface TimeseriesVisualizationProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import React, { lazy } from 'react';
import { IUiSettingsClient } from 'src/core/public';
import { PersistedState } from 'src/plugins/visualizations/public';

import { TimeseriesVisParams } from '../../../metrics_fn';
import { TimeseriesVisParams } from '../../../types';
import { TimeseriesVisData } from '../../../../common/types';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/vis_type_timeseries/public/request_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { KibanaContext } from '../../data/public';
import { getTimezone, validateInterval } from './application';
import { getUISettings, getDataStart, getCoreStart } from './services';
import { MAX_BUCKETS_SETTING, ROUTES } from '../common/constants';
import { TimeseriesVisParams } from './metrics_fn';
import { TimeseriesVisParams } from './types';
import { TimeseriesVisData } from '../common/types';

interface MetricsRequestHandlerParams {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import { IUiSettingsClient } from 'kibana/public';
import type { PersistedState } from '../../visualizations/public';
import { VisualizationContainer } from '../../visualizations/public';
import { ExpressionRenderDefinition } from '../../expressions/common/expression_renderers';
import { TimeseriesRenderValue, TimeseriesVisParams } from './metrics_fn';
import { TimeseriesRenderValue } from './metrics_fn';
import { TimeseriesVisData } from '../common/types';
import { TimeseriesVisParams } from './types';

const TimeseriesVisualization = lazy(
() => import('./application/components/timeseries_visualization')
Expand Down
5 changes: 3 additions & 2 deletions src/plugins/visualize/public/application/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
VisualizeEmbeddableContract,
VisSavedObject,
PersistedState,
VisParams,
} from 'src/plugins/visualizations/public';
import {
CoreStart,
Expand Down Expand Up @@ -114,9 +115,9 @@ export interface ByValueVisInstance {

export type VisualizeEditorVisInstance = SavedVisInstance | ByValueVisInstance;

export type VisEditorConstructor = new (
export type VisEditorConstructor<TVisParams = VisParams> = new (
element: HTMLElement,
vis: Vis,
vis: Vis<TVisParams>,
eventEmitter: EventEmitter,
embeddableHandler: VisualizeEmbeddableContract
) => IEditorController;
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/visualize/public/vis_editors_registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import { VisEditorConstructor } from './application/types';
const DEFAULT_NAME = 'default';

export const createVisEditorsRegistry = () => {
const map = new Map<string, VisEditorConstructor>();
const map = new Map<string, VisEditorConstructor<any>>();

return {
registerDefault: (editor: VisEditorConstructor) => {
map.set(DEFAULT_NAME, editor);
},
register: (name: string, editor: VisEditorConstructor) => {
register: <TVisParams>(name: string, editor: VisEditorConstructor<TVisParams>) => {
if (name) {
map.set(name, editor);
}
Expand Down

0 comments on commit e9a4409

Please sign in to comment.