Переглянути джерело

Chore: Adds typings to lodash (#16590)

Hugo Häggmark 6 роки тому
батько
коміт
7eabc282e9
88 змінених файлів з 149 додано та 145 видалено
  1. 1 0
      package.json
  2. 2 1
      packages/grafana-ui/src/types/data.ts
  3. 1 0
      public/app/app.ts
  4. 4 4
      public/app/core/components/form_dropdown/form_dropdown.ts
  5. 3 4
      public/app/core/components/manage_dashboards/manage_dashboards.ts
  6. 1 1
      public/app/core/components/query_part/query_part_editor.ts
  7. 3 3
      public/app/core/components/sidemenu/BottomSection.tsx
  8. 1 1
      public/app/core/components/sql_part/sql_part_editor.ts
  9. 1 1
      public/app/core/directives/array_join.ts
  10. 3 3
      public/app/core/directives/metric_segment.ts
  11. 1 1
      public/app/core/nav_model_srv.ts
  12. 0 1
      public/app/core/services/backend_srv.ts
  13. 1 2
      public/app/core/services/search_srv.ts
  14. 1 1
      public/app/core/specs/rangeutil.test.ts
  15. 1 1
      public/app/core/utils/reselect.ts
  16. 1 1
      public/app/features/admin/AdminEditUserCtrl.ts
  17. 4 4
      public/app/features/alerting/AlertTabCtrl.ts
  18. 2 2
      public/app/features/annotations/annotations_srv.ts
  19. 1 0
      public/app/features/annotations/editor_ctrl.ts
  20. 2 2
      public/app/features/annotations/events_processing.ts
  21. 1 1
      public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx
  22. 10 11
      public/app/features/dashboard/components/DashExportModal/DashboardExporter.test.ts
  23. 0 1
      public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts
  24. 1 0
      public/app/features/dashboard/components/DashLinks/DashLinksEditorCtrl.ts
  25. 2 2
      public/app/features/dashboard/components/DashboardSettings/SettingsCtrl.ts
  26. 1 1
      public/app/features/dashboard/components/ShareModal/ShareSnapshotCtrl.ts
  27. 1 0
      public/app/features/dashboard/panel_editor/QueriesTab.tsx
  28. 2 2
      public/app/features/dashboard/services/ChangeTracker.ts
  29. 1 1
      public/app/features/dashboard/state/DashboardMigrator.ts
  30. 0 1
      public/app/features/dashboard/state/DashboardModel.test.ts
  31. 3 4
      public/app/features/dashboard/state/DashboardModel.ts
  32. 0 1
      public/app/features/explore/Explore.tsx
  33. 0 1
      public/app/features/explore/QueryField.tsx
  34. 0 1
      public/app/features/explore/QueryRow.tsx
  35. 1 1
      public/app/features/explore/TimePicker.tsx
  36. 0 1
      public/app/features/explore/Typeahead.tsx
  37. 8 6
      public/app/features/explore/state/actions.ts
  38. 0 1
      public/app/features/explore/state/reducers.ts
  39. 1 1
      public/app/features/panel/panellinks/module.ts
  40. 1 1
      public/app/features/plugins/plugin_edit_ctrl.ts
  41. 1 1
      public/app/features/plugins/state/navModel.ts
  42. 2 2
      public/app/features/templating/editor_ctrl.ts
  43. 1 1
      public/app/features/templating/template_srv.ts
  44. 6 6
      public/app/features/templating/variable_srv.ts
  45. 2 2
      public/app/plugins/datasource/cloudwatch/datasource.ts
  46. 1 1
      public/app/plugins/datasource/elasticsearch/config_ctrl.ts
  47. 1 1
      public/app/plugins/datasource/elasticsearch/datasource.ts
  48. 5 5
      public/app/plugins/datasource/elasticsearch/elastic_response.ts
  49. 1 1
      public/app/plugins/datasource/elasticsearch/metric_agg.ts
  50. 3 3
      public/app/plugins/datasource/elasticsearch/query_ctrl.ts
  51. 4 4
      public/app/plugins/datasource/elasticsearch/query_def.ts
  52. 1 1
      public/app/plugins/datasource/grafana-azure-monitor-datasource/app_insights/response_parser.ts
  53. 1 1
      public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_log_analytics/response_parser.ts
  54. 1 1
      public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/response_parser.ts
  55. 1 1
      public/app/plugins/datasource/grafana-azure-monitor-datasource/editor/query_field.tsx
  56. 1 1
      public/app/plugins/datasource/graphite/add_graphite_func.ts
  57. 4 4
      public/app/plugins/datasource/graphite/func_editor.ts
  58. 3 2
      public/app/plugins/datasource/graphite/graphite_query.ts
  59. 1 1
      public/app/plugins/datasource/graphite/query_ctrl.ts
  60. 1 1
      public/app/plugins/datasource/influxdb/influx_series.ts
  61. 2 0
      public/app/plugins/datasource/influxdb/response_parser.ts
  62. 0 1
      public/app/plugins/datasource/loki/language_provider.ts
  63. 1 1
      public/app/plugins/datasource/mixed/datasource.ts
  64. 1 1
      public/app/plugins/datasource/mssql/query_ctrl.ts
  65. 3 3
      public/app/plugins/datasource/mysql/mysql_query.ts
  66. 1 1
      public/app/plugins/datasource/mysql/query_ctrl.ts
  67. 3 3
      public/app/plugins/datasource/opentsdb/datasource.ts
  68. 4 4
      public/app/plugins/datasource/postgres/postgres_query.ts
  69. 1 1
      public/app/plugins/datasource/postgres/query_ctrl.ts
  70. 0 1
      public/app/plugins/datasource/prometheus/components/PromQueryField.tsx
  71. 0 1
      public/app/plugins/datasource/prometheus/language_provider.ts
  72. 1 1
      public/app/plugins/datasource/prometheus/specs/datasource.test.ts
  73. 1 1
      public/app/plugins/datasource/stackdriver/StackdriverMetricFindQuery.ts
  74. 1 1
      public/app/plugins/datasource/stackdriver/components/VariableQueryEditor.tsx
  75. 1 1
      public/app/plugins/datasource/testdata/QueryEditor.tsx
  76. 2 0
      public/app/plugins/datasource/testdata/types.ts
  77. 2 2
      public/app/plugins/panel/graph/Legend/Legend.tsx
  78. 1 1
      public/app/plugins/panel/graph/data_processor.ts
  79. 1 0
      public/app/plugins/panel/graph/graph.ts
  80. 1 1
      public/app/plugins/panel/graph/module.ts
  81. 2 2
      public/app/plugins/panel/heatmap/color_legend.ts
  82. 1 1
      public/app/plugins/panel/heatmap/heatmap_data_converter.ts
  83. 2 2
      public/app/plugins/panel/heatmap/heatmap_tooltip.ts
  84. 1 1
      public/app/plugins/panel/heatmap/rendering.ts
  85. 1 1
      public/app/plugins/panel/table/editor.ts
  86. 1 1
      public/app/plugins/panel/table/renderer.ts
  87. 1 1
      public/app/plugins/panel/table/transformers.ts
  88. 5 0
      yarn.lock

+ 1 - 0
package.json

@@ -28,6 +28,7 @@
     "@types/inquirer": "^0.0.43",
     "@types/jest": "^24.0.11",
     "@types/jquery": "^1.10.35",
+    "@types/lodash": "4.14.123",
     "@types/node": "^8.0.31",
     "@types/papaparse": "^4.5.9",
     "@types/react": "^16.8.8",

+ 2 - 1
packages/grafana-ui/src/types/data.ts

@@ -72,6 +72,7 @@ export enum NullValueMode {
 }
 
 export interface AnnotationEvent {
+  id?: string;
   annotation?: any;
   dashboardId?: number;
   panelId?: number;
@@ -82,5 +83,5 @@ export interface AnnotationEvent {
   title?: string;
   text?: string;
   type?: string;
-  tags?: string;
+  tags?: string[];
 }

+ 1 - 0
public/app/app.ts

@@ -24,6 +24,7 @@ import { addClassIfNoOverlayScrollbar } from 'app/core/utils/scrollbar';
 import { importPluginModule } from 'app/features/plugins/plugin_loader';
 
 // add move to lodash for backward compatabiltiy
+// @ts-ignore
 _.move = (array: [], fromIndex: number, toIndex: number) => {
   array.splice(toIndex, 0, array.splice(fromIndex, 1)[0]);
   return array;

+ 4 - 4
public/app/core/components/form_dropdown/form_dropdown.ts

@@ -120,12 +120,12 @@ export class FormDropdownCtrl {
 
   modelChanged() {
     if (_.isObject(this.model)) {
-      this.updateDisplay(this.model.text);
+      this.updateDisplay((this.model as any).text);
     } else {
       // if we have text use it
       if (this.lookupText) {
         this.getOptionsInternal('').then((options: any) => {
-          const item = _.find(options, { value: this.model });
+          const item: any = _.find(options, { value: this.model });
           this.updateDisplay(item ? item.text : this.model);
         });
       } else {
@@ -193,7 +193,7 @@ export class FormDropdownCtrl {
     }
 
     this.$scope.$apply(() => {
-      const option = _.find(this.optionCache, { text: text });
+      const option: any = _.find(this.optionCache, { text: text });
 
       if (option) {
         if (_.isObject(this.model)) {
@@ -204,7 +204,7 @@ export class FormDropdownCtrl {
         this.text = option.text;
       } else if (this.allowCustom) {
         if (_.isObject(this.model)) {
-          this.model.text = this.model.value = text;
+          (this.model as any).text = (this.model as any).value = text;
         } else {
           this.model = text;
         }

+ 3 - 4
public/app/core/components/manage_dashboards/manage_dashboards.ts

@@ -1,4 +1,3 @@
-// @ts-ignore
 import _ from 'lodash';
 import coreModule from 'app/core/core_module';
 import appEvents from 'app/core/app_events';
@@ -149,7 +148,7 @@ export class ManageDashboardsCtrl {
     let selectedDashboards = 0;
 
     for (const section of this.sections) {
-      selectedDashboards += _.filter(section.items, { checked: true }).length;
+      selectedDashboards += _.filter(section.items, { checked: true } as any).length;
     }
 
     const selectedFolders = _.filter(this.sections, { checked: true }).length;
@@ -167,7 +166,7 @@ export class ManageDashboardsCtrl {
       if (section.checked && section.id !== 0) {
         selectedDashboards.folderUids.push(section.uid);
       } else {
-        const selected = _.filter(section.items, { checked: true });
+        const selected = _.filter(section.items, { checked: true } as any);
         selectedDashboards.dashboardUids.push(..._.map(selected, 'uid'));
       }
     }
@@ -223,7 +222,7 @@ export class ManageDashboardsCtrl {
     const selectedDashboards = [];
 
     for (const section of this.sections) {
-      const selected = _.filter(section.items, { checked: true });
+      const selected = _.filter(section.items, { checked: true } as any);
       selectedDashboards.push(..._.map(selected, 'uid'));
     }
 

+ 1 - 1
public/app/core/components/query_part/query_part_editor.ts

@@ -148,7 +148,7 @@ export function queryPartEditorDirective($compile, templateSrv) {
       };
 
       function addElementsAndCompile() {
-        _.each(partDef.params, (param, index) => {
+        _.each(partDef.params, (param: any, index: number) => {
           if (param.optional && part.params.length <= index) {
             return;
           }

+ 3 - 3
public/app/core/components/sidemenu/BottomSection.tsx

@@ -6,13 +6,13 @@ import { contextSrv } from 'app/core/services/context_srv';
 import config from '../../config';
 
 export default function BottomSection() {
-  const navTree = _.cloneDeep(config.bootData.navTree);
-  const bottomNav = _.filter(navTree, item => item.hideFromMenu);
+  const navTree: any = _.cloneDeep(config.bootData.navTree);
+  const bottomNav: any = _.filter(navTree, item => item.hideFromMenu);
   const isSignedIn = contextSrv.isSignedIn;
   const user = contextSrv.user;
 
   if (user && user.orgCount > 1) {
-    const profileNode = _.find(bottomNav, { id: 'profile' });
+    const profileNode: any = _.find(bottomNav, { id: 'profile' });
     if (profileNode) {
       profileNode.showOrgSwitcher = true;
     }

+ 1 - 1
public/app/core/components/sql_part/sql_part_editor.ts

@@ -162,7 +162,7 @@ export function sqlPartEditorDirective($compile, templateSrv) {
       };
 
       function addElementsAndCompile() {
-        _.each(partDef.params, (param, index) => {
+        _.each(partDef.params, (param: any, index: number) => {
           if (param.optional && part.params.length <= index) {
             return;
           }

+ 1 - 1
public/app/core/directives/array_join.ts

@@ -14,7 +14,7 @@ export function arrayJoin() {
 
       function join_array(text) {
         if (_.isArray(text)) {
-          return (text || '').join(',');
+          return ((text || '') as any).join(',');
         } else {
           return text;
         }

+ 3 - 3
public/app/core/directives/metric_segment.ts

@@ -42,7 +42,7 @@ export function metricSegment($compile, $sce, templateSrv) {
         }
 
         $scope.$apply(() => {
-          const selected = _.find($scope.altSegments, { value: value });
+          const selected: any = _.find($scope.altSegments, { value: value });
           if (selected) {
             segment.value = selected.value;
             segment.html = selected.html || $sce.trustAsHtml(templateSrv.highlightVariablesAsHtml(selected.value));
@@ -202,7 +202,7 @@ export function metricSegmentModel(uiSegmentSrv, $q) {
         let cachedOptions;
 
         $scope.valueToSegment = value => {
-          const option = _.find($scope.options, { value: value });
+          const option: any = _.find($scope.options, { value: value });
           const segment = {
             cssClass: attrs.cssClass,
             custom: attrs.custom,
@@ -236,7 +236,7 @@ export function metricSegmentModel(uiSegmentSrv, $q) {
 
         $scope.onSegmentChange = () => {
           if (cachedOptions) {
-            const option = _.find(cachedOptions, { text: $scope.segment.value });
+            const option: any = _.find(cachedOptions, { text: $scope.segment.value });
             if (option && option.value !== $scope.property) {
               $scope.property = option.value;
             } else if (attrs.custom !== 'false') {

+ 1 - 1
public/app/core/nav_model_srv.ts

@@ -48,7 +48,7 @@ export class NavModelSrv {
         break;
       }
 
-      const node = _.find(children, { id: id });
+      const node: any = _.find(children, { id: id });
       nav.breadcrumbs.push(node);
       nav.node = node;
       nav.main = node;

+ 0 - 1
public/app/core/services/backend_srv.ts

@@ -1,4 +1,3 @@
-// @ts-ignore
 import _ from 'lodash';
 import angular from 'angular';
 import coreModule from 'app/core/core_module';

+ 1 - 2
public/app/core/services/search_srv.ts

@@ -1,4 +1,3 @@
-// @ts-ignore
 import _ from 'lodash';
 // @ts-ignore
 import { IQService } from 'angular';
@@ -41,7 +40,7 @@ export class SearchSrv {
     });
   }
 
-  private queryForRecentDashboards(): Promise<number[]> {
+  private queryForRecentDashboards(): Promise<DashboardSearchHit[]> {
     const dashIds: number[] = _.take(impressionSrv.getDashboardOpened(), 30);
     if (dashIds.length === 0) {
       return Promise.resolve([]);

+ 1 - 1
public/app/core/specs/rangeutil.test.ts

@@ -5,7 +5,7 @@ import moment from 'moment';
 describe('rangeUtil', () => {
   describe('Can get range grouped list of ranges', () => {
     it('when custom settings should return default range list', () => {
-      const groups = rangeUtil.getRelativeTimesList({ time_options: [] }, 'Last 5 minutes');
+      const groups: any = rangeUtil.getRelativeTimesList({ time_options: [] }, 'Last 5 minutes');
       expect(_.keys(groups).length).toBe(4);
       expect(groups[3][0].active).toBe(true);
     });

+ 1 - 1
public/app/core/utils/reselect.ts

@@ -2,4 +2,4 @@ import { memoize } from 'lodash';
 import { createSelectorCreator } from 'reselect';
 
 const hashFn = (...args) => args.reduce((acc, val) => acc + '-' + JSON.stringify(val), '');
-export const createLodashMemoizedSelector = createSelectorCreator(memoize, hashFn);
+export const createLodashMemoizedSelector = createSelectorCreator(memoize as any, hashFn);

+ 1 - 1
public/app/features/admin/AdminEditUserCtrl.ts

@@ -98,7 +98,7 @@ export default class AdminEditUserCtrl {
         return;
       }
 
-      const orgInfo = _.find($scope.orgsSearchCache, {
+      const orgInfo: any = _.find($scope.orgsSearchCache, {
         name: $scope.newOrg.name,
       });
       if (!orgInfo) {

+ 4 - 4
public/app/features/alerting/AlertTabCtrl.ts

@@ -129,7 +129,7 @@ export class AlertTabCtrl {
   }
 
   notificationAdded() {
-    const model = _.find(this.notifications, {
+    const model: any = _.find(this.notifications, {
       name: this.addNotificationSegment.value,
     });
     if (!model) {
@@ -157,8 +157,8 @@ export class AlertTabCtrl {
   removeNotification(an) {
     // remove notifiers refeered to by id and uid to support notifiers added
     // before and after we added support for uid
-    _.remove(this.alert.notifications, n => n.uid === an.uid || n.id === an.id);
-    _.remove(this.alertNotifications, n => n.uid === an.uid || n.id === an.id);
+    _.remove(this.alert.notifications, (n: any) => n.uid === an.uid || n.id === an.id);
+    _.remove(this.alertNotifications, (n: any) => n.uid === an.uid || n.id === an.id);
   }
 
   initModel() {
@@ -195,7 +195,7 @@ export class AlertTabCtrl {
 
     for (const addedNotification of alert.notifications) {
       // lookup notifier type by uid
-      let model = _.find(this.notifications, { uid: addedNotification.uid });
+      let model: any = _.find(this.notifications, { uid: addedNotification.uid });
 
       // fallback to using id if uid is missing
       if (!model) {

+ 2 - 2
public/app/features/annotations/annotations_srv.ts

@@ -38,7 +38,7 @@ export class AnnotationsSrv {
       .all([this.getGlobalAnnotations(options), this.getAlertStates(options)])
       .then(results => {
         // combine the annotations and flatten results
-        let annotations = _.flattenDeep(results[0]);
+        let annotations: any[] = _.flattenDeep(results[0]);
 
         // filter out annotations that do not belong to requesting panel
         annotations = _.filter(annotations, item => {
@@ -53,7 +53,7 @@ export class AnnotationsSrv {
         annotations = makeRegions(annotations, options);
 
         // look for alert state for this panel
-        const alertState = _.find(results[1], { panelId: options.panel.id });
+        const alertState: any = _.find(results[1], { panelId: options.panel.id });
 
         return {
           annotations: annotations,

+ 1 - 0
public/app/features/annotations/editor_ctrl.ts

@@ -74,6 +74,7 @@ export class AnnotationsEditorCtrl {
   }
 
   move(index, dir) {
+    // @ts-ignore
     _.move(this.annotations, index, index + dir);
   }
 

+ 2 - 2
public/app/features/annotations/events_processing.ts

@@ -17,10 +17,10 @@ function getRegions(events, range) {
   const regionEvents = _.filter(events, event => {
     return event.regionId;
   });
-  let regions = _.groupBy(regionEvents, 'regionId');
+  let regions: any = _.groupBy(regionEvents, 'regionId');
   regions = _.compact(
     _.map(regions, regionEvents => {
-      const regionObj = _.head(regionEvents);
+      const regionObj: any = _.head(regionEvents);
       if (regionEvents && regionEvents.length > 1) {
         regionObj.timeEnd = regionEvents[1].time;
         regionObj.isRegion = true;

+ 1 - 1
public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx

@@ -45,7 +45,7 @@ export class AddPanelWidget extends React.Component<Props, State> {
     const copiedPanelJson = store.get(LS_PANEL_COPY_KEY);
     if (copiedPanelJson) {
       const copiedPanel = JSON.parse(copiedPanelJson);
-      const pluginInfo = _.find(panels, { id: copiedPanel.type });
+      const pluginInfo: any = _.find(panels, { id: copiedPanel.type });
       if (pluginInfo) {
         const pluginCopy = _.cloneDeep(pluginInfo);
         pluginCopy.name = copiedPanel.title;

+ 10 - 11
public/app/features/dashboard/components/DashExportModal/DashboardExporter.test.ts

@@ -4,7 +4,6 @@ jest.mock('app/core/store', () => {
   };
 });
 
-// @ts-ignore
 import _ from 'lodash';
 import config from 'app/core/config';
 import { DashboardExporter } from './DashboardExporter';
@@ -148,7 +147,7 @@ describe('given dashboard with repeated panels', () => {
   });
 
   it('should add datasource to required', () => {
-    const require = _.find(exported.__requires, { name: 'TestDB' });
+    const require: any = _.find(exported.__requires, { name: 'TestDB' });
     expect(require.name).toBe('TestDB');
     expect(require.id).toBe('testdb');
     expect(require.type).toBe('datasource');
@@ -156,52 +155,52 @@ describe('given dashboard with repeated panels', () => {
   });
 
   it('should not add built in datasources to required', () => {
-    const require = _.find(exported.__requires, { name: 'Mixed' });
+    const require: any = _.find(exported.__requires, { name: 'Mixed' });
     expect(require).toBe(undefined);
   });
 
   it('should add datasources used in mixed mode', () => {
-    const require = _.find(exported.__requires, { name: 'OtherDB' });
+    const require: any = _.find(exported.__requires, { name: 'OtherDB' });
     expect(require).not.toBe(undefined);
   });
 
   it('should add graph panel to required', () => {
-    const require = _.find(exported.__requires, { name: 'Graph' });
+    const require: any = _.find(exported.__requires, { name: 'Graph' });
     expect(require.name).toBe('Graph');
     expect(require.id).toBe('graph');
     expect(require.version).toBe('1.1.0');
   });
 
   it('should add table panel to required', () => {
-    const require = _.find(exported.__requires, { name: 'Table' });
+    const require: any = _.find(exported.__requires, { name: 'Table' });
     expect(require.name).toBe('Table');
     expect(require.id).toBe('table');
     expect(require.version).toBe('1.1.1');
   });
 
   it('should add heatmap panel to required', () => {
-    const require = _.find(exported.__requires, { name: 'Heatmap' });
+    const require: any = _.find(exported.__requires, { name: 'Heatmap' });
     expect(require.name).toBe('Heatmap');
     expect(require.id).toBe('heatmap');
     expect(require.version).toBe('1.1.2');
   });
 
   it('should add grafana version', () => {
-    const require = _.find(exported.__requires, { name: 'Grafana' });
+    const require: any = _.find(exported.__requires, { name: 'Grafana' });
     expect(require.type).toBe('grafana');
     expect(require.id).toBe('grafana');
     expect(require.version).toBe('3.0.2');
   });
 
   it('should add constant template variables as inputs', () => {
-    const input = _.find(exported.__inputs, { name: 'VAR_PREFIX' });
+    const input: any = _.find(exported.__inputs, { name: 'VAR_PREFIX' });
     expect(input.type).toBe('constant');
     expect(input.label).toBe('prefix');
     expect(input.value).toBe('collectd');
   });
 
   it('should templatize constant variables', () => {
-    const variable = _.find(exported.templating.list, { name: 'prefix' });
+    const variable: any = _.find(exported.templating.list, { name: 'prefix' });
     expect(variable.query).toBe('${VAR_PREFIX}');
     expect(variable.current.text).toBe('${VAR_PREFIX}');
     expect(variable.current.value).toBe('${VAR_PREFIX}');
@@ -210,7 +209,7 @@ describe('given dashboard with repeated panels', () => {
   });
 
   it('should add datasources only use via datasource variable to requires', () => {
-    const require = _.find(exported.__requires, { name: 'OtherDB_2' });
+    const require: any = _.find(exported.__requires, { name: 'OtherDB_2' });
     expect(require.id).toBe('other2');
   });
 });

+ 0 - 1
public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts

@@ -1,4 +1,3 @@
-// @ts-ignore
 import _ from 'lodash';
 
 import config from 'app/core/config';

+ 1 - 0
public/app/features/dashboard/components/DashLinks/DashLinksEditorCtrl.ts

@@ -55,6 +55,7 @@ export class DashLinksEditorCtrl {
   }
 
   moveLink(index, dir) {
+    // @ts-ignore
     _.move(this.dashboard.links, index, index + dir);
   }
 

+ 2 - 2
public/app/features/dashboard/components/DashboardSettings/SettingsCtrl.ts

@@ -126,7 +126,7 @@ export class SettingsCtrl {
       this.viewId = 'make_editable';
     }
 
-    const currentSection = _.find(this.sections, { id: this.viewId });
+    const currentSection: any = _.find(this.sections, { id: this.viewId } as any);
     if (!currentSection) {
       this.sections.unshift({
         title: 'Not found',
@@ -174,7 +174,7 @@ export class SettingsCtrl {
     this.viewId = 'settings';
     this.buildSectionList();
 
-    const currentSection = _.find(this.sections, { id: this.viewId });
+    const currentSection: any = _.find(this.sections, { id: this.viewId } as any);
     this.$location.url(currentSection.url);
   }
 

+ 1 - 1
public/app/features/dashboard/components/ShareModal/ShareSnapshotCtrl.ts

@@ -99,7 +99,7 @@ export class ShareSnapshotCtrl {
         .filter(annotation => {
           return annotation.enable;
         })
-        .map(annotation => {
+        .map((annotation: any) => {
           return {
             name: annotation.name,
             enable: annotation.enable,

+ 1 - 0
public/app/features/dashboard/panel_editor/QueriesTab.tsx

@@ -122,6 +122,7 @@ export class QueriesTab extends PureComponent<Props, State> {
     const { panel } = this.props;
 
     const index = _.indexOf(panel.targets, query);
+    // @ts-ignore
     _.move(panel.targets, index, index + direction);
 
     this.forceUpdate();

+ 2 - 2
public/app/features/dashboard/services/ChangeTracker.ts

@@ -141,8 +141,8 @@ export class ChangeTracker {
     const current = this.cleanDashboardFromIgnoredChanges(this.current.getSaveModelClone());
     const original = this.cleanDashboardFromIgnoredChanges(this.original);
 
-    const currentTimepicker = _.find(current.nav, { type: 'timepicker' });
-    const originalTimepicker = _.find(original.nav, { type: 'timepicker' });
+    const currentTimepicker: any = _.find(current.nav, { type: 'timepicker' });
+    const originalTimepicker: any = _.find(original.nav, { type: 'timepicker' });
 
     if (currentTimepicker && originalTimepicker) {
       currentTimepicker.now = originalTimepicker.now;

+ 1 - 1
public/app/features/dashboard/state/DashboardMigrator.ts

@@ -109,7 +109,7 @@ export class DashboardMigrator {
 
     if (oldVersion < 6) {
       // move pulldowns to new schema
-      const annotations = _.find(old.pulldowns, { type: 'annotations' });
+      const annotations: any = _.find(old.pulldowns, { type: 'annotations' });
 
       if (annotations) {
         this.dashboard.annotations = {

+ 0 - 1
public/app/features/dashboard/state/DashboardModel.test.ts

@@ -1,4 +1,3 @@
-// @ts-ignore
 import _ from 'lodash';
 import { DashboardModel } from '../state/DashboardModel';
 import { PanelModel } from '../state/PanelModel';

+ 3 - 4
public/app/features/dashboard/state/DashboardModel.ts

@@ -1,6 +1,5 @@
 // Libaries
 import moment, { MomentInput } from 'moment';
-// @ts-ignore
 import _ from 'lodash';
 
 // Constants
@@ -179,7 +178,7 @@ export class DashboardModel {
     if (!defaults.saveVariables) {
       for (let i = 0; i < copy.templating.list.length; i++) {
         const current = copy.templating.list[i];
-        const original = _.find(this.originalTemplating, { name: current.name, type: current.type });
+        const original: any = _.find(this.originalTemplating, { name: current.name, type: current.type });
 
         if (!original) {
           continue;
@@ -449,7 +448,7 @@ export class DashboardModel {
   }
 
   repeatPanel(panel: PanelModel, panelIndex: number) {
-    const variable = _.find(this.templating.list, { name: panel.repeat });
+    const variable: any = _.find(this.templating.list, { name: panel.repeat } as any);
     if (!variable) {
       return;
     }
@@ -719,7 +718,7 @@ export class DashboardModel {
 
     if (row.collapsed) {
       row.collapsed = false;
-      const hasRepeat = _.some(row.panels, (p: PanelModel) => p.repeat);
+      const hasRepeat = _.some(row.panels as PanelModel[], (p: PanelModel) => p.repeat);
 
       if (row.panels.length > 0) {
         // Use first panel to figure out if it was moved or pushed

+ 0 - 1
public/app/features/explore/Explore.tsx

@@ -3,7 +3,6 @@ import React, { ComponentClass } from 'react';
 import { hot } from 'react-hot-loader';
 // @ts-ignore
 import { connect } from 'react-redux';
-// @ts-ignore
 import _ from 'lodash';
 import { AutoSizer } from 'react-virtualized';
 

+ 0 - 1
public/app/features/explore/QueryField.tsx

@@ -1,4 +1,3 @@
-// @ts-ignore
 import _ from 'lodash';
 import React, { Context } from 'react';
 import ReactDOM from 'react-dom';

+ 0 - 1
public/app/features/explore/QueryRow.tsx

@@ -1,6 +1,5 @@
 // Libraries
 import React, { PureComponent } from 'react';
-// @ts-ignore
 import _ from 'lodash';
 import { hot } from 'react-hot-loader';
 // @ts-ignore

+ 1 - 1
public/app/features/explore/TimePicker.tsx

@@ -241,7 +241,7 @@ export default class TimePicker extends PureComponent<TimePickerProps, TimePicke
               const group = timeOptions[section];
               return (
                 <ul key={section}>
-                  {group.map(option => (
+                  {group.map((option: any) => (
                     <li className={option.active ? 'active' : ''} key={option.display}>
                       <a onClick={() => this.handleClickRelativeOption(option)}>{option.display}</a>
                     </li>

+ 0 - 1
public/app/features/explore/Typeahead.tsx

@@ -1,5 +1,4 @@
 import React, { createRef } from 'react';
-// @ts-ignore
 import _ from 'lodash';
 import { FixedSizeList } from 'react-window';
 

+ 8 - 6
public/app/features/explore/state/actions.ts

@@ -1,5 +1,4 @@
 // Libraries
-// @ts-ignore
 import _ from 'lodash';
 
 // Services & Utils
@@ -196,11 +195,14 @@ export function loadExploreDatasourcesAndSetDatasource(
   return dispatch => {
     const exploreDatasources: DataSourceSelectItem[] = getDatasourceSrv()
       .getExternal()
-      .map((ds: any) => ({
-        value: ds.name,
-        name: ds.name,
-        meta: ds.meta,
-      }));
+      .map(
+        (ds: any) =>
+          ({
+            value: ds.name,
+            name: ds.name,
+            meta: ds.meta,
+          } as DataSourceSelectItem)
+      );
 
     dispatch(loadExploreDatasources({ exploreId, exploreDatasources }));
 

+ 0 - 1
public/app/features/explore/state/reducers.ts

@@ -1,4 +1,3 @@
-// @ts-ignore
 import _ from 'lodash';
 import {
   calculateResultsFromQueryTransactions,

+ 1 - 1
public/app/features/panel/panellinks/module.ts

@@ -37,7 +37,7 @@ export class PanelLinksEditorCtrl {
 
     $scope.dashboardChanged = link => {
       backendSrv.search({ query: link.dashboard }).then(hits => {
-        const dashboard = _.find(hits, { title: link.dashboard });
+        const dashboard: any = _.find(hits, { title: link.dashboard });
         if (dashboard) {
           if (dashboard.url) {
             link.url = dashboard.url;

+ 1 - 1
public/app/features/plugins/plugin_edit_ctrl.ts

@@ -53,7 +53,7 @@ export class PluginEditCtrl {
         url: `plugins/${this.model.id}/edit?tab=config`,
       });
 
-      const hasDashboards = _.find(model.includes, { type: 'dashboard' });
+      const hasDashboards: any = _.find(model.includes, { type: 'dashboard' });
 
       if (hasDashboards) {
         this.navModel.main.children.push({

+ 1 - 1
public/app/features/plugins/state/navModel.ts

@@ -34,7 +34,7 @@ export function buildNavModel(ds: DataSourceSettings, plugin: PluginMeta, curren
     ],
   };
 
-  const hasDashboards = _.find(plugin.includes, { type: 'dashboard' }) !== undefined;
+  const hasDashboards: any = _.find(plugin.includes, { type: 'dashboard' }) !== undefined;
   if (hasDashboards && ds.id) {
     main.children.push({
       active: currentPage === 'datasource-dashboards',

+ 2 - 2
public/app/features/templating/editor_ctrl.ts

@@ -64,7 +64,7 @@ export class VariableEditorCtrl {
         return false;
       }
 
-      const sameName = _.find($scope.variables, { name: $scope.current.name });
+      const sameName: any = _.find($scope.variables, { name: $scope.current.name });
       if (sameName && sameName !== $scope.current) {
         appEvents.emit('alert-warning', ['Validation', 'Variable with the same name already exists']);
         return false;
@@ -151,7 +151,7 @@ export class VariableEditorCtrl {
 
       $scope.datasourceTypes = _($scope.datasources)
         .uniqBy('meta.id')
-        .map(ds => {
+        .map((ds: any) => {
           return { text: ds.meta.name, value: ds.meta.id };
         })
         .value();

+ 1 - 1
public/app/features/templating/template_srv.ts

@@ -309,7 +309,7 @@ export class TemplateSrv {
   }
 
   distributeVariable(value, variable) {
-    value = _.map(value, (val, index) => {
+    value = _.map(value, (val: any, index: number) => {
       if (index !== 0) {
         return variable + '=' + val;
       } else {

+ 6 - 6
public/app/features/templating/variable_srv.ts

@@ -200,7 +200,7 @@ export class VariableSrv {
 
       return variable.setValue(selected);
     } else {
-      const currentOption = _.find(variable.options, {
+      const currentOption: any = _.find(variable.options, {
         text: variable.current.text,
       });
       if (currentOption) {
@@ -222,7 +222,7 @@ export class VariableSrv {
     }
 
     return promise.then(() => {
-      let option = _.find(variable.options, op => {
+      let option: any = _.find(variable.options, op => {
         return op.text === urlValue || op.value === urlValue;
       });
 
@@ -233,7 +233,7 @@ export class VariableSrv {
         defaultText = [];
 
         for (let n = 0; n < urlValue.length; n++) {
-          const t = _.find(variable.options, op => {
+          const t: any = _.find(variable.options, op => {
             return op.value === urlValue[n];
           });
 
@@ -279,10 +279,10 @@ export class VariableSrv {
   }
 
   setAdhocFilter(options) {
-    let variable = _.find(this.variables, {
+    let variable: any = _.find(this.variables, {
       type: 'adhoc',
       datasource: options.datasource,
-    });
+    } as any);
     if (!variable) {
       variable = this.createVariableFromModel({
         name: 'Filters',
@@ -293,7 +293,7 @@ export class VariableSrv {
     }
 
     const filters = variable.filters;
-    let filter = _.find(filters, { key: options.key, value: options.value });
+    let filter: any = _.find(filters, { key: options.key, value: options.value });
 
     if (!filter) {
       filter = { key: options.key, value: options.value };

+ 2 - 2
public/app/plugins/datasource/cloudwatch/datasource.ts

@@ -410,7 +410,7 @@ export default class CloudWatchDatasource implements DataSourceApi<CloudWatchQue
 
   getExpandedVariables(target, dimensionKey, variable, templateSrv) {
     /* if the all checkbox is marked we should add all values to the targets */
-    const allSelected = _.find(variable.options, { selected: true, text: 'All' });
+    const allSelected: any = _.find(variable.options, { selected: true, text: 'All' });
     const selectedVariables = _.filter(variable.options, v => {
       if (allSelected) {
         return v.text !== 'All';
@@ -427,7 +427,7 @@ export default class CloudWatchDatasource implements DataSourceApi<CloudWatchQue
           };
         });
     const useSelectedVariables =
-      selectedVariables.some(s => {
+      selectedVariables.some((s: any) => {
         return s.value === currentVariables[0].value;
       }) || currentVariables[0].value === '$__all';
     return (useSelectedVariables ? selectedVariables : currentVariables).map(v => {

+ 1 - 1
public/app/plugins/datasource/elasticsearch/config_ctrl.ts

@@ -33,7 +33,7 @@ export class ElasticConfigCtrl {
       this.current.database.length === 0 ||
       this.current.database.startsWith('[logstash-]')
     ) {
-      const def = _.find(this.indexPatternTypes, {
+      const def: any = _.find(this.indexPatternTypes, {
         value: this.current.jsonData.interval,
       });
       this.current.database = def.example || 'es-index-name';

+ 1 - 1
public/app/plugins/datasource/elasticsearch/datasource.ts

@@ -204,7 +204,7 @@ export class ElasticDatasource {
     // validate that the index exist and has date field
     return this.getFields({ type: 'date' }).then(
       dateFields => {
-        const timeField = _.find(dateFields, { text: this.timeField });
+        const timeField: any = _.find(dateFields, { text: this.timeField });
         if (!timeField) {
           return {
             status: 'error',

+ 5 - 5
public/app/plugins/datasource/elasticsearch/elastic_response.ts

@@ -222,7 +222,7 @@ export class ElasticResponse {
   }
 
   private getMetricName(metric) {
-    let metricDef = _.find(queryDef.metricAggTypes, { value: metric });
+    let metricDef: any = _.find(queryDef.metricAggTypes, { value: metric });
     if (!metricDef) {
       metricDef = _.find(queryDef.extendedStats, { value: metric });
     }
@@ -258,12 +258,12 @@ export class ElasticResponse {
 
     if (series.field && queryDef.isPipelineAgg(series.metric)) {
       if (series.metric && queryDef.isPipelineAggWithMultipleBucketPaths(series.metric)) {
-        const agg = _.find(target.metrics, { id: series.metricId });
+        const agg: any = _.find(target.metrics, { id: series.metricId });
         if (agg && agg.settings.script) {
           metricName = agg.settings.script;
 
           for (const pv of agg.pipelineVariables) {
-            const appliedAgg = _.find(target.metrics, { id: pv.pipelineAgg });
+            const appliedAgg: any = _.find(target.metrics, { id: pv.pipelineAgg });
             if (appliedAgg) {
               metricName = metricName.replace('params.' + pv.name, queryDef.describeMetric(appliedAgg));
             }
@@ -272,7 +272,7 @@ export class ElasticResponse {
           metricName = 'Unset';
         }
       } else {
-        const appliedAgg = _.find(target.metrics, { id: series.field });
+        const appliedAgg: any = _.find(target.metrics, { id: series.field });
         if (appliedAgg) {
           metricName += ' ' + queryDef.describeMetric(appliedAgg);
         } else {
@@ -343,7 +343,7 @@ export class ElasticResponse {
   }
 
   trimDatapoints(aggregations, target) {
-    const histogram = _.find(target.bucketAggs, { type: 'date_histogram' });
+    const histogram: any = _.find(target.bucketAggs, { type: 'date_histogram' });
 
     const shouldDropFirstAndLast = histogram && histogram.settings && histogram.settings.trimEdges;
     if (shouldDropFirstAndLast) {

+ 1 - 1
public/app/plugins/datasource/elasticsearch/metric_agg.ts

@@ -81,7 +81,7 @@ export class ElasticMetricAggCtrl {
             $scope.agg.meta,
             (memo, val, key) => {
               if (val) {
-                const def = _.find($scope.extendedStats, { value: key });
+                const def: any = _.find($scope.extendedStats, { value: key });
                 memo.push(def.text);
               }
               return memo;

+ 3 - 3
public/app/plugins/datasource/elasticsearch/query_ctrl.ts

@@ -66,7 +66,7 @@ export class ElasticQueryCtrl extends QueryCtrl {
     text += 'Metrics: ';
 
     _.each(metricAggs, (metric, index) => {
-      const aggDef = _.find(metricAggTypes, { value: metric.type });
+      const aggDef: any = _.find(metricAggTypes, { value: metric.type });
       text += aggDef.text + '(';
       if (aggDef.requiresField) {
         text += metric.field;
@@ -77,12 +77,12 @@ export class ElasticQueryCtrl extends QueryCtrl {
       text += '), ';
     });
 
-    _.each(bucketAggs, (bucketAgg, index) => {
+    _.each(bucketAggs, (bucketAgg: any, index: number) => {
       if (index === 0) {
         text += ' Group by: ';
       }
 
-      const aggDef = _.find(bucketAggTypes, { value: bucketAgg.type });
+      const aggDef: any = _.find(bucketAggTypes, { value: bucketAgg.type });
       text += aggDef.text + '(';
       if (aggDef.requiresField) {
         text += bucketAgg.field;

+ 4 - 4
public/app/plugins/datasource/elasticsearch/query_def.ts

@@ -224,12 +224,12 @@ export function getOrderByOptions(target) {
 }
 
 export function describeOrder(order) {
-  const def = _.find(orderOptions, { value: order });
+  const def: any = _.find(orderOptions, { value: order });
   return def.text;
 }
 
 export function describeMetric(metric) {
-  const def = _.find(metricAggTypes, { value: metric.type });
+  const def: any = _.find(metricAggTypes, { value: metric.type });
   if (!def.requiresField && !isPipelineAgg(metric.type)) {
     return def.text;
   }
@@ -237,11 +237,11 @@ export function describeMetric(metric) {
 }
 
 export function describeOrderBy(orderBy, target) {
-  const def = _.find(orderByOptions, { value: orderBy });
+  const def: any = _.find(orderByOptions, { value: orderBy });
   if (def) {
     return def.text;
   }
-  const metric = _.find(target.metrics, { id: orderBy });
+  const metric: any = _.find(target.metrics, { id: orderBy });
   if (metric) {
     return describeMetric(metric);
   } else {

+ 1 - 1
public/app/plugins/datasource/grafana-azure-monitor-datasource/app_insights/response_parser.ts

@@ -144,7 +144,7 @@ export default class ResponseParser {
   }
 
   static findOrCreateBucket(data, target) {
-    let dataTarget = _.find(data, ['target', target]);
+    let dataTarget: any = _.find(data, ['target', target]);
     if (!dataTarget) {
       dataTarget = { target: target, datapoints: [] };
       data.push(dataTarget);

+ 1 - 1
public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_log_analytics/response_parser.ts

@@ -254,7 +254,7 @@ export default class ResponseParser {
   }
 
   static findOrCreateBucket(data, target): DataTarget {
-    let dataTarget = _.find(data, ['target', target]);
+    let dataTarget: any = _.find(data, ['target', target]);
     if (!dataTarget) {
       dataTarget = { target: target, datapoints: [], refId: '', query: '' };
       data.push(dataTarget);

+ 1 - 1
public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/response_parser.ts

@@ -136,7 +136,7 @@ export default class ResponseParser {
   }
 
   static parseMetadata(result: any, metricName: string) {
-    const metricData = _.find(result.data.value, o => {
+    const metricData: any = _.find(result.data.value, o => {
       return _.get(o, 'name.value') === metricName;
     });
 

+ 1 - 1
public/app/plugins/datasource/grafana-azure-monitor-datasource/editor/query_field.tsx

@@ -245,7 +245,7 @@ class QueryField extends React.Component<any, any> {
 
     // Get the currently selected suggestion
     const flattenedSuggestions = flattenSuggestions(suggestions);
-    const suggestion = _.find(
+    const suggestion: any = _.find(
       flattenedSuggestions,
       suggestion => suggestion.display === item || suggestion.text === item
     );

+ 1 - 1
public/app/plugins/datasource/graphite/add_graphite_func.ts

@@ -35,7 +35,7 @@ export function graphiteAddFunc($compile) {
           minLength: 1,
           items: 10,
           updater: value => {
-            let funcDef = ctrl.datasource.getFuncDef(value);
+            let funcDef: any = ctrl.datasource.getFuncDef(value);
             if (!funcDef) {
               // try find close match
               value = value.toLowerCase();

+ 4 - 4
public/app/plugins/datasource/graphite/func_editor.ts

@@ -77,7 +77,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
         if (index < func.def.params.length) {
           return func.def.params[index];
         }
-        if (_.last(func.def.params).multiple) {
+        if ((_.last(func.def.params) as any).multiple) {
           return _.assign({}, _.last(func.def.params), { optional: true });
         }
         return {};
@@ -170,14 +170,14 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
       function addElementsAndCompile() {
         $funcLink.appendTo(elem);
 
-        const defParams = _.clone(func.def.params);
-        const lastParam = _.last(func.def.params);
+        const defParams: any = _.clone(func.def.params);
+        const lastParam: any = _.last(func.def.params);
 
         while (func.params.length >= defParams.length && lastParam && lastParam.multiple) {
           defParams.push(_.assign({}, lastParam, { optional: true }));
         }
 
-        _.each(defParams, (param, index) => {
+        _.each(defParams, (param: any, index: number) => {
           if (param.optional && func.params.length < index) {
             return false;
           }

+ 3 - 2
public/app/plugins/datasource/graphite/graphite_query.ts

@@ -61,7 +61,7 @@ export default class GraphiteQuery {
   }
 
   checkForSeriesByTag() {
-    const seriesByTagFunc = _.find(this.functions, func => func.def.name === 'seriesByTag');
+    const seriesByTagFunc: any = _.find(this.functions, func => func.def.name === 'seriesByTag');
     if (seriesByTagFunc) {
       this.seriesByTagUsed = true;
       seriesByTagFunc.hidden = true;
@@ -135,7 +135,7 @@ export default class GraphiteQuery {
   }
 
   moveAliasFuncLast() {
-    const aliasFunc = _.find(this.functions, func => {
+    const aliasFunc: any = _.find(this.functions, func => {
       return func.def.name.startsWith('alias');
     });
 
@@ -158,6 +158,7 @@ export default class GraphiteQuery {
 
   moveFunction(func, offset) {
     const index = this.functions.indexOf(func);
+    // @ts-ignore
     _.move(this.functions, index, index + offset);
   }
 

+ 1 - 1
public/app/plugins/datasource/graphite/query_ctrl.ts

@@ -182,7 +182,7 @@ export class GraphiteQueryCtrl extends QueryCtrl {
     });
   }
 
-  removeTaggedEntry(altSegments) {
+  removeTaggedEntry(altSegments: any[]) {
     altSegments = _.remove(altSegments, s => s.value === '_tagged');
   }
 

+ 1 - 1
public/app/plugins/datasource/influxdb/influx_series.ts

@@ -151,7 +151,7 @@ export default class InfluxSeries {
       return table;
     }
 
-    _.each(this.series, (series, seriesIndex) => {
+    _.each(this.series, (series: any, seriesIndex: number) => {
       if (seriesIndex === 0) {
         j = 0;
         // Check that the first column is indeed 'time'

+ 2 - 0
public/app/plugins/datasource/influxdb/response_parser.ts

@@ -44,7 +44,9 @@ export default class ResponseParser {
       });
     });
 
+    // @ts-ignore problems with typings for this _.map only accepts [] but this needs to be object
     return _.map(res, value => {
+      // @ts-ignore
       return { text: value.toString() };
     });
   }

+ 0 - 1
public/app/plugins/datasource/loki/language_provider.ts

@@ -1,5 +1,4 @@
 // Libraries
-// @ts-ignore
 import _ from 'lodash';
 import moment from 'moment';
 

+ 1 - 1
public/app/plugins/datasource/mixed/datasource.ts

@@ -9,7 +9,7 @@ class MixedDatasource implements DataSourceApi<DataQuery> {
 
   query(options: DataQueryOptions<DataQuery>) {
     const sets = _.groupBy(options.targets, 'datasource');
-    const promises = _.map(sets, (targets: DataQuery[]) => {
+    const promises: any = _.map(sets, (targets: DataQuery[]) => {
       const dsName = targets[0].datasource;
       if (dsName === '-- Mixed --') {
         return Promise.resolve([]);

+ 1 - 1
public/app/plugins/datasource/mssql/query_ctrl.ts

@@ -59,7 +59,7 @@ export class MssqlQueryCtrl extends QueryCtrl {
     this.lastQueryMeta = null;
     this.lastQueryError = null;
 
-    const anySeriesFromQuery = _.find(dataList, { refId: this.target.refId });
+    const anySeriesFromQuery: any = _.find(dataList, { refId: this.target.refId });
     if (anySeriesFromQuery) {
       this.lastQueryMeta = anySeriesFromQuery.meta;
     }

+ 3 - 3
public/app/plugins/datasource/mysql/mysql_query.ts

@@ -149,17 +149,17 @@ export default class MysqlQuery {
   buildValueColumn(column) {
     let query = '';
 
-    const columnName = _.find(column, (g: any) => g.type === 'column');
+    const columnName: any = _.find(column, (g: any) => g.type === 'column');
     query = columnName.params[0];
 
-    const aggregate = _.find(column, (g: any) => g.type === 'aggregate');
+    const aggregate: any = _.find(column, (g: any) => g.type === 'aggregate');
 
     if (aggregate) {
       const func = aggregate.params[0];
       query = func + '(' + query + ')';
     }
 
-    const alias = _.find(column, (g: any) => g.type === 'alias');
+    const alias: any = _.find(column, (g: any) => g.type === 'alias');
     if (alias) {
       query += ' AS ' + this.quoteIdentifier(alias.params[0]);
     }

+ 1 - 1
public/app/plugins/datasource/mysql/query_ctrl.ts

@@ -253,7 +253,7 @@ export class MysqlQueryCtrl extends QueryCtrl {
     this.lastQueryMeta = null;
     this.lastQueryError = null;
 
-    const anySeriesFromQuery = _.find(dataList, { refId: this.target.refId });
+    const anySeriesFromQuery: any = _.find(dataList, { refId: this.target.refId });
     if (anySeriesFromQuery) {
       this.lastQueryMeta = anySeriesFromQuery.meta;
     }

+ 3 - 3
public/app/plugins/datasource/opentsdb/datasource.ts

@@ -72,7 +72,7 @@ export default class OpenTsDatasource {
 
     return this.performTimeSeriesQuery(queries, start, end).then(response => {
       const metricToTargetMapping = this.mapMetricsToTargets(response.data, options, this.tsdbVersion);
-      const result = _.map(response.data, (metricData, index) => {
+      const result = _.map(response.data, (metricData: any, index: number) => {
         index = metricToTargetMapping[index];
         if (index === -1) {
           index = 0;
@@ -347,7 +347,7 @@ export default class OpenTsDatasource {
 
     // TSDB returns datapoints has a hash of ts => value.
     // Can't use _.pairs(invert()) because it stringifies keys/values
-    _.each(md.dps, (v, k) => {
+    _.each(md.dps, (v: any, k: number) => {
       if (tsdbResolution === 2) {
         dps.push([v, k * 1]);
       } else {
@@ -466,7 +466,7 @@ export default class OpenTsDatasource {
       if (tsdbVersion === 3) {
         return metricData.query.index;
       } else {
-        return _.findIndex(options.targets, target => {
+        return _.findIndex(options.targets as any[], target => {
           if (target.filters && target.filters.length > 0) {
             return target.metric === metricData.metric;
           } else {

+ 4 - 4
public/app/plugins/datasource/postgres/postgres_query.ts

@@ -149,11 +149,11 @@ export default class PostgresQuery {
   buildValueColumn(column) {
     let query = '';
 
-    const columnName = _.find(column, (g: any) => g.type === 'column');
+    const columnName: any = _.find(column, (g: any) => g.type === 'column');
     query = columnName.params[0];
 
-    const aggregate = _.find(column, (g: any) => g.type === 'aggregate' || g.type === 'percentile');
-    const windows = _.find(column, (g: any) => g.type === 'window' || g.type === 'moving_window');
+    const aggregate: any = _.find(column, (g: any) => g.type === 'aggregate' || g.type === 'percentile');
+    const windows: any = _.find(column, (g: any) => g.type === 'window' || g.type === 'moving_window');
 
     if (aggregate) {
       const func = aggregate.params[0];
@@ -218,7 +218,7 @@ export default class PostgresQuery {
       }
     }
 
-    const alias = _.find(column, (g: any) => g.type === 'alias');
+    const alias: any = _.find(column, (g: any) => g.type === 'alias');
     if (alias) {
       query += ' AS ' + this.quoteIdentifier(alias.params[0]);
     }

+ 1 - 1
public/app/plugins/datasource/postgres/query_ctrl.ts

@@ -284,7 +284,7 @@ export class PostgresQueryCtrl extends QueryCtrl {
     this.lastQueryMeta = null;
     this.lastQueryError = null;
 
-    const anySeriesFromQuery = _.find(dataList, { refId: this.target.refId });
+    const anySeriesFromQuery: any = _.find(dataList, { refId: this.target.refId });
     if (anySeriesFromQuery) {
       this.lastQueryMeta = anySeriesFromQuery.meta;
     }

+ 0 - 1
public/app/plugins/datasource/prometheus/components/PromQueryField.tsx

@@ -1,4 +1,3 @@
-// @ts-ignore
 import _ from 'lodash';
 import React from 'react';
 // @ts-ignore

+ 0 - 1
public/app/plugins/datasource/prometheus/language_provider.ts

@@ -1,4 +1,3 @@
-// @ts-ignore
 import _ from 'lodash';
 import moment from 'moment';
 

+ 1 - 1
public/app/plugins/datasource/prometheus/specs/datasource.test.ts

@@ -23,7 +23,7 @@ describe('PrometheusDatasource', () => {
     directUrl: 'direct',
     user: 'test',
     password: 'mupp',
-    jsonData: {},
+    jsonData: {} as any,
   };
 
   ctx.backendSrvMock = {};

+ 1 - 1
public/app/plugins/datasource/stackdriver/StackdriverMetricFindQuery.ts

@@ -42,7 +42,7 @@ export default class StackdriverMetricFindQuery {
 
   async handleServiceQuery() {
     const metricDescriptors = await this.datasource.getMetricTypes(this.datasource.projectName);
-    const services = extractServicesFromMetricDescriptors(metricDescriptors);
+    const services: any[] = extractServicesFromMetricDescriptors(metricDescriptors);
     return services.map(s => ({
       text: s.serviceShortName,
       value: s.service,

+ 1 - 1
public/app/plugins/datasource/stackdriver/components/VariableQueryEditor.tsx

@@ -34,7 +34,7 @@ export class StackdriverVariableQueryEditor extends PureComponent<VariableQueryP
 
   async componentDidMount() {
     const metricDescriptors = await this.props.datasource.getMetricTypes(this.props.datasource.projectName);
-    const services = extractServicesFromMetricDescriptors(metricDescriptors).map(m => ({
+    const services = extractServicesFromMetricDescriptors(metricDescriptors).map((m: any) => ({
       value: m.service,
       name: m.serviceShortName,
     }));

+ 1 - 1
public/app/plugins/datasource/testdata/QueryEditor.tsx

@@ -35,7 +35,7 @@ export class QueryEditor extends PureComponent<Props> {
 
     // const scenarioList = await this.backendSrv.get('/api/tsdb/testdata/scenarios');
     const scenarioList = await datasource.getScenarios();
-    const current = _.find(scenarioList, { id: query.scenarioId });
+    const current: any = _.find(scenarioList, { id: query.scenarioId });
 
     this.setState({ scenarioList: scenarioList, current: current });
   }

+ 2 - 0
public/app/plugins/datasource/testdata/types.ts

@@ -3,6 +3,8 @@ import { DataQuery } from '@grafana/ui/src/types';
 export interface TestDataQuery extends DataQuery {
   alias?: string;
   scenarioId: string;
+  stringInput: string;
+  points: any;
 }
 
 export interface Scenario {

+ 2 - 2
public/app/plugins/panel/graph/Legend/Legend.tsx

@@ -88,7 +88,7 @@ export class GraphLegend extends PureComponent<GraphLegendProps, LegendState> {
   }
 
   sortLegend() {
-    let seriesList = [...this.props.seriesList] || [];
+    let seriesList: TimeSeries[] = [...this.props.seriesList] || [];
     if (this.props.sort) {
       seriesList = _.sortBy(seriesList, series => {
         let sort = series.stats[this.props.sort];
@@ -96,7 +96,7 @@ export class GraphLegend extends PureComponent<GraphLegendProps, LegendState> {
           sort = -Infinity;
         }
         return sort;
-      });
+      }) as TimeSeries[];
       if (this.props.sortDesc) {
         seriesList = seriesList.reverse();
       }

+ 1 - 1
public/app/plugins/panel/graph/data_processor.ts

@@ -156,7 +156,7 @@ export class DataProcessor {
         }
 
         const validOptions = this.getXAxisValueOptions({});
-        const found = _.find(validOptions, { value: this.panel.xaxis.values[0] });
+        const found: any = _.find(validOptions, { value: this.panel.xaxis.values[0] });
         if (!found) {
           this.panel.xaxis.values = ['total'];
         }

+ 1 - 0
public/app/plugins/panel/graph/graph.ts

@@ -574,6 +574,7 @@ class GraphElement {
         return [tickIndex + 1, point[1]];
       });
     });
+    // @ts-ignore, potential bug? is this _.flattenDeep?
     ticks = _.flatten(ticks, true);
 
     options.xaxis = {

+ 1 - 1
public/app/plugins/panel/graph/module.ts

@@ -262,7 +262,7 @@ class GraphCtrl extends MetricsPanelCtrl {
   };
 
   onToggleAxis = info => {
-    let override = _.find(this.panel.seriesOverrides, { alias: info.alias });
+    let override: any = _.find(this.panel.seriesOverrides, { alias: info.alias });
     if (!override) {
       override = { alias: info.alias };
       this.panel.seriesOverrides.push(override);

+ 2 - 2
public/app/plugins/panel/heatmap/color_legend.ts

@@ -36,7 +36,7 @@ coreModule.directive('colorLegend', () => {
         const legendWidth = Math.floor(legendElem.outerWidth());
 
         if (panel.color.mode === 'spectrum') {
-          const colorScheme = _.find(ctrl.colorSchemes, {
+          const colorScheme: any = _.find(ctrl.colorSchemes, {
             value: panel.color.colorScheme,
           });
           const colorScale = getColorScale(colorScheme, contextSrv.user.lightTheme, legendWidth);
@@ -76,7 +76,7 @@ coreModule.directive('heatmapLegend', () => {
           const minValue = cardStats.min;
 
           if (panel.color.mode === 'spectrum') {
-            const colorScheme = _.find(ctrl.colorSchemes, {
+            const colorScheme: any = _.find(ctrl.colorSchemes, {
               value: panel.color.colorScheme,
             });
             drawColorLegend(elem, colorScheme, rangeFrom, rangeTo, maxValue, minValue);

+ 1 - 1
public/app/plugins/panel/heatmap/heatmap_data_converter.ts

@@ -253,7 +253,7 @@ function convertToHeatMap(seriesList, yBucketSize, xBucketSize, logBase = 1) {
   // |*   | --/ |1|,
   // |____|     |0|
   //
-  _.forEach(heatmap, xBucket => {
+  _.forEach(heatmap, (xBucket: any) => {
     if (logBase !== 1) {
       xBucket.buckets = convertToLogScaleValueBuckets(xBucket, yBucketSize, logBase);
     } else {

+ 2 - 2
public/app/plugins/panel/heatmap/heatmap_tooltip.ts

@@ -81,7 +81,7 @@ export class HeatmapTooltip {
     let boundBottom, boundTop, valuesNumber;
     const xData = data.buckets[xBucketIndex];
     // Search in special 'zero' bucket also
-    const yData = _.find(xData.buckets, (bucket, bucketIndex) => {
+    const yData: any = _.find(xData.buckets, (bucket, bucketIndex) => {
       return bucket.bounds.bottom === yBucketIndex || bucketIndex === yBucketIndex.toString();
     });
 
@@ -161,7 +161,7 @@ export class HeatmapTooltip {
   getXBucketIndex(x, data) {
     // First try to find X bucket by checking x pos is in the
     // [bucket.x, bucket.x + xBucketSize] interval
-    const xBucket = _.find(data.buckets, bucket => {
+    const xBucket: any = _.find(data.buckets, bucket => {
       return x > bucket.x && x - bucket.x <= data.xBucketSize;
     });
     return xBucket ? xBucket.x : getValueBucketBound(x, data.xBucketSize, 1);

+ 1 - 1
public/app/plugins/panel/heatmap/rendering.ts

@@ -529,7 +529,7 @@ export class HeatmapRenderer {
     const minValueAuto = Math.min(cardStats.min, 0);
     const maxValue = _.isNil(this.panel.color.max) ? maxValueAuto : this.panel.color.max;
     const minValue = _.isNil(this.panel.color.min) ? minValueAuto : this.panel.color.min;
-    const colorScheme = _.find(this.ctrl.colorSchemes, {
+    const colorScheme: any = _.find(this.ctrl.colorSchemes, {
       value: this.panel.color.colorScheme,
     });
     this.colorScale = getColorScale(colorScheme, contextSrv.user.lightTheme, maxValue, minValue);

+ 1 - 1
public/app/plugins/panel/table/editor.ts

@@ -52,7 +52,7 @@ export class TablePanelEditorCtrl {
 
   addColumn() {
     const columns = transformers[this.panel.transform].getColumns(this.panelCtrl.dataRaw);
-    const column = _.find(columns, { text: this.addColumnSegment.value });
+    const column: any = _.find(columns, { text: this.addColumnSegment.value });
 
     if (column) {
       this.panel.columns.push(column);

+ 1 - 1
public/app/plugins/panel/table/renderer.ts

@@ -101,7 +101,7 @@ export class TableRenderer {
         }
 
         // if is an epoch (numeric string and len > 12)
-        if (_.isString(v) && !isNaN(v) && v.length > 12) {
+        if (_.isString(v) && !isNaN(v as any) && v.length > 12) {
           v = parseInt(v, 10);
         }
 

+ 1 - 1
public/app/plugins/panel/table/transformers.ts

@@ -154,7 +154,7 @@ transformers['table'] = {
 
     return columns;
   },
-  transform: (data, panel, model) => {
+  transform: (data: any[], panel, model) => {
     if (!data || data.length === 0) {
       return;
     }

+ 5 - 0
yarn.lock

@@ -2333,6 +2333,11 @@
   resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-1.10.35.tgz#4e5c2b1e5b3bf0b863efb8c5e70081f52e6c9518"
   integrity sha512-SVtqEcudm7yjkTwoRA1gC6CNMhGDdMx4Pg8BPdiqI7bXXdCn1BPmtxgeWYQOgDxrq53/5YTlhq5ULxBEAlWIBg==
 
+"@types/lodash@4.14.123":
+  version "4.14.123"
+  resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.123.tgz#39be5d211478c8dd3bdae98ee75bb7efe4abfe4d"
+  integrity sha512-pQvPkc4Nltyx7G1Ww45OjVqUsJP4UsZm+GWJpigXgkikZqJgRm4c48g027o6tdgubWHwFRF15iFd+Y4Pmqv6+Q==
+
 "@types/lodash@^4.14.119":
   version "4.14.119"
   resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.119.tgz#be847e5f4bc3e35e46d041c394ead8b603ad8b39"