Chore: some type fixes (#69860)

* some type fixes

* restore empty object

* undo 1 fix for now

* commit betterer update

* explicitly type slug and uid as string | undefined
This commit is contained in:
Ashley Harrison
2023-06-20 17:13:49 +01:00
committed by GitHub
parent c07d3c7bdd
commit 13e3308959
17 changed files with 91 additions and 141 deletions

View File

@@ -272,10 +272,10 @@ export class DashboardGrid extends PureComponent<Props> {
}
}
interface GrafanaGridItemProps extends Record<string, any> {
interface GrafanaGridItemProps extends React.HTMLAttributes<HTMLDivElement> {
gridWidth?: number;
gridPos?: GridPos;
isViewing: string;
isViewing: boolean;
windowHeight: number;
windowWidth: number;
children: any;
@@ -306,8 +306,15 @@ const GrafanaGridItem = React.forwardRef<HTMLDivElement, GrafanaGridItemProps>((
style.width = '100%';
} else {
// Normal grid layout. The grid framework passes width and height directly to children as style props.
width = parseFloat(props.style.width);
height = parseFloat(props.style.height);
if (props.style) {
const { width: styleWidth, height: styleHeight } = props.style;
if (styleWidth != null) {
width = typeof styleWidth === 'number' ? styleWidth : parseFloat(styleWidth);
}
if (styleHeight != null) {
height = typeof styleHeight === 'number' ? styleHeight : parseFloat(styleHeight);
}
}
}
// props.children[0] is our main children. RGL adds the drag handle at props.children[1]