Chore: reduces strict null errors to 824 (#22744)

* Chore: reduces strict null errors with 100+

* Chore: lowers the build error number
This commit is contained in:
Hugo Häggmark
2020-03-12 10:22:33 +01:00
committed by GitHub
parent 4fecf5a7a6
commit b51e28bc15
35 changed files with 202 additions and 160 deletions

View File

@@ -79,6 +79,7 @@ describe('PromExploreQueryEditor', () => {
});
it('should render PromQueryField with ExtraFieldElement', async () => {
// @ts-ignore strict null errpr TS2345: Argument of type '() => Promise<void>' is not assignable to parameter of type '() => void | undefined'.
await act(async () => {
const wrapper = setup(mount);
expect(wrapper.find(PromExploreExtraField).length).toBe(1);

View File

@@ -1,11 +1,15 @@
import { getValueFromEventItem, promSettingsValidationEvents } from './PromSettings';
import { EventsWithValidation } from '@grafana/ui';
import { SyntheticEvent } from 'react';
import { SelectableValue } from '@grafana/data';
describe('PromSettings', () => {
describe('getValueFromEventItem', () => {
describe('when called with undefined', () => {
it('then it should return empty string', () => {
const result = getValueFromEventItem(undefined);
const result = getValueFromEventItem(
(undefined as unknown) as SyntheticEvent<HTMLInputElement> | SelectableValue<string>
);
expect(result).toEqual('');
});
});

View File

@@ -17,7 +17,7 @@ describe('Prometheus Result Transformer', () => {
status: 'success',
data: {
resultType: '',
result: null as DataQueryResponseData[],
result: (null as unknown) as DataQueryResponseData[],
},
};
const series = ctx.resultTransformer.transform({ data: response }, {});
@@ -28,7 +28,7 @@ describe('Prometheus Result Transformer', () => {
status: 'success',
data: {
resultType: '',
result: null as DataQueryResponseData[],
result: (null as unknown) as DataQueryResponseData[],
},
};
const table = ctx.resultTransformer.transform({ data: response }, { format: 'table' });