Skip to content

Commit f830ec2

Browse files
authored
[Maps] convert map_selectors to TS (#65905) (#66321)
* [Maps] convert map_selectors to TS * fix paths * one more path fix
1 parent 0a07c8e commit f830ec2

File tree

18 files changed

+166
-118
lines changed

18 files changed

+166
-118
lines changed

x-pack/plugins/maps/common/descriptor_types/descriptor_types.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export type LayerDescriptor = {
132132
__dataRequests?: DataRequestDescriptor[];
133133
__isInErrorState?: boolean;
134134
__errorMessage?: string;
135+
__trackedLayerDescriptor?: LayerDescriptor;
135136
alpha?: number;
136137
id: string;
137138
label?: string | null;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { IESTermSource } from '../sources/es_term_source';
8+
import { IJoin } from './join';
9+
import { JoinDescriptor } from '../../../common/descriptor_types';
10+
import { ISource } from '../sources/source';
11+
12+
export class InnerJoin implements IJoin {
13+
constructor(joinDescriptor: JoinDescriptor, leftSource: ISource);
14+
15+
getRightJoinSource(): IESTermSource;
16+
17+
toDescriptor(): JoinDescriptor;
18+
}

x-pack/plugins/maps/public/classes/joins/join.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
*/
66

77
import { IESTermSource } from '../sources/es_term_source';
8+
import { JoinDescriptor } from '../../../common/descriptor_types';
89

910
export interface IJoin {
1011
getRightJoinSource(): IESTermSource;
12+
13+
toDescriptor(): JoinDescriptor;
1114
}

x-pack/plugins/maps/public/classes/layers/layer.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ import {
1919
MIN_ZOOM,
2020
SOURCE_DATA_ID_ORIGIN,
2121
} from '../../../common/constants';
22-
// @ts-ignore
23-
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
24-
import { copyPersistentState } from '../../reducers/util.js';
22+
import { copyPersistentState } from '../../reducers/util';
2523
import {
2624
LayerDescriptor,
2725
MapExtent,

x-pack/plugins/maps/public/classes/layers/tile_layer/tile_layer.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ interface ITileLayerArguments {
1414
}
1515

1616
export class TileLayer extends AbstractLayer {
17+
static type: string;
1718
constructor(args: ITileLayerArguments);
1819
}

x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export interface IVectorLayer extends ILayer {
3232
}
3333

3434
export class VectorLayer extends AbstractLayer implements IVectorLayer {
35+
static type: string;
36+
3537
protected readonly _style: IVectorStyle;
3638
static createDescriptor(
3739
options: Partial<VectorLayerDescriptor>,

x-pack/plugins/maps/public/classes/sources/source.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
import { ReactElement } from 'react';
1010

1111
import { Adapters } from 'src/plugins/inspector/public';
12-
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
13-
// @ts-ignore
1412
import { copyPersistentState } from '../../reducers/util';
1513

1614
import { SourceDescriptor } from '../../../common/descriptor_types';

x-pack/plugins/maps/public/reducers/map.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export type MapContext = {
2222
zoom?: number;
2323
center?: MapCenter;
2424
scrollZoom: boolean;
25+
buffer?: MapExtent;
2526
extent?: MapExtent;
2627
mouseCoordinates?: {
2728
lat: number;

x-pack/plugins/maps/public/reducers/map.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const updateLayerSourceDescriptorProp = (state, layerId, propName, value) => {
102102
return { ...state, layerList: updatedList };
103103
};
104104

105-
const INITIAL_STATE = {
105+
export const DEFAULT_MAP_STATE = {
106106
ready: false,
107107
mapInitError: null,
108108
goto: null,
@@ -133,7 +133,7 @@ const INITIAL_STATE = {
133133
__rollbackSettings: null,
134134
};
135135

136-
export function map(state = INITIAL_STATE, action) {
136+
export function map(state = DEFAULT_MAP_STATE, action) {
137137
switch (action.type) {
138138
case UPDATE_DRAW_STATE:
139139
return {

x-pack/plugins/maps/public/reducers/non_serializable_instances.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ interface EventHandlers {
2424

2525
export function setEventHandlers(eventHandlers?: EventHandlers): AnyAction;
2626

27-
export function getInspectorAdapters(args: unknown): Adapters | undefined;
27+
export function getInspectorAdapters(args: unknown): Adapters;

0 commit comments

Comments
 (0)