From 8fafe95728c0a2bcf0cdabfc857c049cfc80bd81 Mon Sep 17 00:00:00 2001 From: Denis Hilt Date: Thu, 18 Mar 2021 10:23:58 +0300 Subject: [PATCH] DashNav: Pass typed event through the DashNav button onClick handler (#32084) * Pass typed event thorough the DashNav button onClick handler Event.stopPropagation() method needs to be called in some cases. This change addresses typescript error Type '(event: ...) => void' is not assignable to type '() => void'. * Pass typed event thorough the DashNav button onClick handler * Import MouseEvent from React --- .../features/dashboard/components/DashNav/DashNavButton.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/features/dashboard/components/DashNav/DashNavButton.tsx b/public/app/features/dashboard/components/DashNav/DashNavButton.tsx index c1f137700f1..7a7423b9a4b 100644 --- a/public/app/features/dashboard/components/DashNav/DashNavButton.tsx +++ b/public/app/features/dashboard/components/DashNav/DashNavButton.tsx @@ -1,5 +1,5 @@ // Libraries -import React, { FunctionComponent } from 'react'; +import React, { FunctionComponent, MouseEvent } from 'react'; import { css } from 'emotion'; // Components import { IconName, IconType, IconSize, IconButton, useTheme, stylesFactory } from '@grafana/ui'; @@ -8,7 +8,7 @@ import { GrafanaTheme } from '@grafana/data'; interface Props { icon?: IconName; tooltip: string; - onClick?: () => void; + onClick?: (event: MouseEvent) => void; href?: string; children?: React.ReactNode; iconType?: IconType;