Typescript: Fixed strict null errors. (#25609)

This commit is contained in:
Marcus Andersson 2020-06-16 07:34:27 +02:00 committed by GitHub
parent bd76c66e50
commit fb7d036fa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 11 deletions

View File

@ -45,7 +45,7 @@ export class BarGaugePanel extends PureComponent<PanelProps<BarGaugeOptions>> {
const { value } = valueProps;
const { hasLinks, getLinks } = value;
if (!hasLinks) {
if (!hasLinks || !getLinks) {
return this.renderComponent(valueProps, {});
}

View File

@ -35,7 +35,7 @@ export class GaugePanel extends PureComponent<PanelProps<GaugeOptions>> {
const { value } = valueProps;
const { getLinks, hasLinks } = value;
if (!hasLinks) {
if (!hasLinks || !getLinks) {
return this.renderComponent(valueProps, {});
}

View File

@ -246,7 +246,7 @@ class GraphCtrl extends MetricsPanelCtrl {
);
}
getDataWarning(): DataWarning {
getDataWarning(): DataWarning | undefined {
const datapointsCount = this.seriesList.reduce((prev, series) => {
return prev + series.datapoints.length;
}, 0);
@ -302,8 +302,7 @@ class GraphCtrl extends MetricsPanelCtrl {
return dataWarning;
}
return null;
return undefined;
}
onRender() {

View File

@ -1,3 +1,4 @@
import { isString } from 'lodash';
import { PanelPlugin } from '@grafana/data';
import { NewsPanel } from './NewsPanel';
import { NewsOptions } from './types';
@ -18,7 +19,7 @@ export const plugin = new PanelPlugin<NewsOptions>(NewsPanel).setPanelOptions(bu
name: 'Use Proxy',
description: 'If the feed is unable to connect, consider a CORS proxy',
showIf: (currentConfig: NewsOptions) => {
return currentConfig.feedUrl && !currentConfig.feedUrl.startsWith(PROXY_PREFIX);
return isString(currentConfig.feedUrl) && !currentConfig.feedUrl.startsWith(PROXY_PREFIX);
},
});
});

View File

@ -90,7 +90,7 @@ describe('SingleStatCtrl', () => {
});
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');
});

View File

@ -65,7 +65,7 @@ export class StatPanel extends PureComponent<PanelProps<StatPanelOptions>> {
const { value } = valueProps;
const { getLinks, hasLinks } = value;
if (!hasLinks) {
if (!hasLinks || !getLinks) {
return this.renderComponent(valueProps, {});
}

View File

@ -2,9 +2,7 @@
echo -e "Collecting code stats (typescript errors & more)"
ERROR_COUNT_LIMIT=726
ERROR_COUNT_LIMIT=724
DIRECTIVES_LIMIT=172
CONTROLLERS_LIMIT=139