Chore: fix some types (#58662)

chore: fix some types
This commit is contained in:
Ashley Harrison
2022-11-11 16:29:49 +00:00
committed by GitHub
parent 860e25df3c
commit 500cf16142
26 changed files with 61 additions and 117 deletions

View File

@@ -5,7 +5,7 @@ import { BrowserRouter } from 'react-router-dom';
import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock';
import { NavModel, NavModelItem } from '@grafana/data';
import { setBackendSrv } from '@grafana/runtime';
import { BackendSrv, setBackendSrv } from '@grafana/runtime';
import { GrafanaContext } from 'app/core/context/GrafanaContext';
import { configureStore } from 'app/store/configureStore';
@@ -23,7 +23,7 @@ jest.mock('@grafana/runtime', () => ({
setBackendSrv({
get: jest.fn().mockResolvedValue([]),
} as any);
} as unknown as BackendSrv);
describe('DashboardSettings', () => {
it('pressing escape navigates away correctly', async () => {

View File

@@ -7,7 +7,7 @@ import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock';
import { byRole } from 'testing-library-selector';
import { selectors } from '@grafana/e2e-selectors';
import { setBackendSrv } from '@grafana/runtime';
import { BackendSrv, setBackendSrv } from '@grafana/runtime';
import { GrafanaContext } from 'app/core/context/GrafanaContext';
import { DashboardModel } from '../../state';
@@ -16,7 +16,7 @@ import { GeneralSettingsUnconnected as GeneralSettings, Props } from './GeneralS
setBackendSrv({
get: jest.fn().mockResolvedValue([]),
} as any);
} as unknown as BackendSrv);
const setupTestContext = (options: Partial<Props>) => {
const defaults: Props = {

View File

@@ -37,7 +37,9 @@ export function GeneralSettingsUnconnected({
};
const onBlur = (event: React.FocusEvent<HTMLInputElement>) => {
dashboard[event.currentTarget.name as 'title' | 'description'] = event.currentTarget.value;
if (event.currentTarget.name === 'title' || event.currentTarget.name === 'description') {
dashboard[event.currentTarget.name] = event.currentTarget.value;
}
};
const onTooltipChange = (graphTooltip: number) => {

View File

@@ -21,7 +21,7 @@ type State = {
isAppending: boolean;
versions: DecoratedRevisionModel[];
viewMode: 'list' | 'compare';
diffData: { lhs: any; rhs: any };
diffData: { lhs: unknown; rhs: unknown };
newInfo?: DecoratedRevisionModel;
baseInfo?: DecoratedRevisionModel;
isNewLatest: boolean;