Commit fb7d036f by Marcus Andersson Committed by GitHub

Typescript: Fixed strict null errors. (#25609)

parent bd76c66e
...@@ -45,7 +45,7 @@ export class BarGaugePanel extends PureComponent<PanelProps<BarGaugeOptions>> { ...@@ -45,7 +45,7 @@ export class BarGaugePanel extends PureComponent<PanelProps<BarGaugeOptions>> {
const { value } = valueProps; const { value } = valueProps;
const { hasLinks, getLinks } = value; const { hasLinks, getLinks } = value;
if (!hasLinks) { if (!hasLinks || !getLinks) {
return this.renderComponent(valueProps, {}); return this.renderComponent(valueProps, {});
} }
......
...@@ -35,7 +35,7 @@ export class GaugePanel extends PureComponent<PanelProps<GaugeOptions>> { ...@@ -35,7 +35,7 @@ export class GaugePanel extends PureComponent<PanelProps<GaugeOptions>> {
const { value } = valueProps; const { value } = valueProps;
const { getLinks, hasLinks } = value; const { getLinks, hasLinks } = value;
if (!hasLinks) { if (!hasLinks || !getLinks) {
return this.renderComponent(valueProps, {}); return this.renderComponent(valueProps, {});
} }
......
...@@ -246,7 +246,7 @@ class GraphCtrl extends MetricsPanelCtrl { ...@@ -246,7 +246,7 @@ class GraphCtrl extends MetricsPanelCtrl {
); );
} }
getDataWarning(): DataWarning { getDataWarning(): DataWarning | undefined {
const datapointsCount = this.seriesList.reduce((prev, series) => { const datapointsCount = this.seriesList.reduce((prev, series) => {
return prev + series.datapoints.length; return prev + series.datapoints.length;
}, 0); }, 0);
...@@ -302,8 +302,7 @@ class GraphCtrl extends MetricsPanelCtrl { ...@@ -302,8 +302,7 @@ class GraphCtrl extends MetricsPanelCtrl {
return dataWarning; return dataWarning;
} }
return undefined;
return null;
} }
onRender() { onRender() {
......
import { isString } from 'lodash';
import { PanelPlugin } from '@grafana/data'; import { PanelPlugin } from '@grafana/data';
import { NewsPanel } from './NewsPanel'; import { NewsPanel } from './NewsPanel';
import { NewsOptions } from './types'; import { NewsOptions } from './types';
...@@ -18,7 +19,7 @@ export const plugin = new PanelPlugin<NewsOptions>(NewsPanel).setPanelOptions(bu ...@@ -18,7 +19,7 @@ export const plugin = new PanelPlugin<NewsOptions>(NewsPanel).setPanelOptions(bu
name: 'Use Proxy', name: 'Use Proxy',
description: 'If the feed is unable to connect, consider a CORS proxy', description: 'If the feed is unable to connect, consider a CORS proxy',
showIf: (currentConfig: NewsOptions) => { showIf: (currentConfig: NewsOptions) => {
return currentConfig.feedUrl && !currentConfig.feedUrl.startsWith(PROXY_PREFIX); return isString(currentConfig.feedUrl) && !currentConfig.feedUrl.startsWith(PROXY_PREFIX);
}, },
}); });
}); });
...@@ -90,7 +90,7 @@ describe('SingleStatCtrl', () => { ...@@ -90,7 +90,7 @@ describe('SingleStatCtrl', () => {
}); });
it('Should use series avg as default main value', () => { it('Should use series avg as default main value', () => {
const name = getFieldDisplayName(ctx.data.field); const name = getFieldDisplayName(ctx.data.field!);
expect(name).toBe('test.cpu1'); expect(name).toBe('test.cpu1');
}); });
......
...@@ -65,7 +65,7 @@ export class StatPanel extends PureComponent<PanelProps<StatPanelOptions>> { ...@@ -65,7 +65,7 @@ export class StatPanel extends PureComponent<PanelProps<StatPanelOptions>> {
const { value } = valueProps; const { value } = valueProps;
const { getLinks, hasLinks } = value; const { getLinks, hasLinks } = value;
if (!hasLinks) { if (!hasLinks || !getLinks) {
return this.renderComponent(valueProps, {}); return this.renderComponent(valueProps, {});
} }
......
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
echo -e "Collecting code stats (typescript errors & more)" echo -e "Collecting code stats (typescript errors & more)"
ERROR_COUNT_LIMIT=724
ERROR_COUNT_LIMIT=726
DIRECTIVES_LIMIT=172 DIRECTIVES_LIMIT=172
CONTROLLERS_LIMIT=139 CONTROLLERS_LIMIT=139
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment