any/type assertion fixes (#57009)
This commit is contained in:
@@ -29,6 +29,6 @@ const fromRCOptions = (options: RCCascaderOption[]): CascaderOption[] => {
|
||||
const fromRCOption = (option: RCCascaderOption): CascaderOption => {
|
||||
return {
|
||||
value: option.value ?? '',
|
||||
label: option.label as unknown as string,
|
||||
label: option.label,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { css, cx } from '@emotion/css';
|
||||
import Prism, { Grammar, LanguageMap } from 'prismjs';
|
||||
import React, { memo, RefObject, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import React, { memo, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { Popper as ReactPopper } from 'react-popper';
|
||||
import usePrevious from 'react-use/lib/usePrevious';
|
||||
import { Value } from 'slate';
|
||||
@@ -74,7 +74,7 @@ const getStyles = (theme: GrafanaTheme2) => ({
|
||||
// was used and changes to different state were propagated here.
|
||||
export const DataLinkInput: React.FC<DataLinkInputProps> = memo(
|
||||
({ value, onChange, suggestions, placeholder = 'http://your-grafana.com/d/000000010/annotations' }) => {
|
||||
const editorRef = useRef<Editor>() as RefObject<Editor>;
|
||||
const editorRef = useRef<Editor>(null);
|
||||
const styles = useStyles2(getStyles);
|
||||
const [showingSuggestions, setShowingSuggestions] = useState(false);
|
||||
const [suggestionsIndex, setSuggestionsIndex] = useState(0);
|
||||
|
||||
@@ -10,14 +10,18 @@ export class SelectionReference implements VirtualElement {
|
||||
return rect;
|
||||
}
|
||||
|
||||
return {
|
||||
const fallbackDOMRect: DOMRect = {
|
||||
top: 0,
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
width: 0,
|
||||
height: 0,
|
||||
} as DOMRect;
|
||||
x: 0,
|
||||
y: 0,
|
||||
toJSON: () => {},
|
||||
};
|
||||
return fallbackDOMRect;
|
||||
}
|
||||
|
||||
get clientWidth() {
|
||||
|
||||
@@ -23,8 +23,8 @@ export const FormattedValueDisplay: FC<Props> = ({ value, className, style, ...h
|
||||
const hasSuffix = (value.suffix ?? '').length > 0;
|
||||
let suffixStyle;
|
||||
|
||||
if (style && style.fontSize) {
|
||||
const fontSize = style?.fontSize as number;
|
||||
if (style && style.fontSize && typeof style.fontSize === 'number') {
|
||||
const fontSize = style.fontSize;
|
||||
const reductionFactor = fontSizeReductionFactor(fontSize);
|
||||
suffixStyle = { fontSize: fontSize * reductionFactor };
|
||||
}
|
||||
|
||||
@@ -89,9 +89,10 @@ const mockGraphProps = (multiSeries = false) => {
|
||||
};
|
||||
};
|
||||
|
||||
(window as any).ResizeObserver = class ResizeObserver {
|
||||
window.ResizeObserver = class ResizeObserver {
|
||||
constructor() {}
|
||||
observe() {}
|
||||
unobserve() {}
|
||||
disconnect() {}
|
||||
};
|
||||
|
||||
|
||||
@@ -117,8 +117,9 @@ export class Graph extends PureComponent<GraphProps, GraphState> {
|
||||
return uniqBy(
|
||||
series.map((s) => {
|
||||
const index = s.yAxis ? s.yAxis.index : 1;
|
||||
const min = s.yAxis && !isNaN(s.yAxis.min as number) ? s.yAxis.min : null;
|
||||
const tickDecimals = s.yAxis && !isNaN(s.yAxis.tickDecimals as number) ? s.yAxis.tickDecimals : null;
|
||||
const min = s.yAxis && s.yAxis.min && !isNaN(s.yAxis.min) ? s.yAxis.min : null;
|
||||
const tickDecimals =
|
||||
s.yAxis && s.yAxis.tickDecimals && !isNaN(s.yAxis.tickDecimals) ? s.yAxis.tickDecimals : null;
|
||||
return {
|
||||
show: true,
|
||||
index,
|
||||
|
||||
@@ -15,7 +15,7 @@ export function getIntervalFromString(strInterval: string): SelectableValue<numb
|
||||
}
|
||||
|
||||
interface Props {
|
||||
func: () => any; // TODO
|
||||
func: () => unknown;
|
||||
loading: boolean;
|
||||
interval: string;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ interface Props<V, D> {
|
||||
renderValue: (props: VizRepeaterRenderValueProps<V, D>) => JSX.Element;
|
||||
height: number;
|
||||
width: number;
|
||||
source: any; // If this changes, new values will be requested
|
||||
source: unknown; // If this changes, new values will be requested
|
||||
getValues: () => V[];
|
||||
renderCounter: number; // force update of values & render
|
||||
orientation: VizOrientation;
|
||||
|
||||
Reference in New Issue
Block a user