From a04e9aa986aea518481a8fe1ceb0fd5e72bcb6c4 Mon Sep 17 00:00:00 2001 From: John Knox Date: Wed, 4 Sep 2019 03:30:16 -0700 Subject: [PATCH] Fix NotificationsHub types Reviewed By: passy Differential Revision: D17167014 fbshipit-source-id: f7981c75252059c6eaa3518ca0fd9524f5039db6 --- src/NotificationsHub.tsx | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/NotificationsHub.tsx b/src/NotificationsHub.tsx index 4465c10f2..bf856f02c 100644 --- a/src/NotificationsHub.tsx +++ b/src/NotificationsHub.tsx @@ -31,10 +31,11 @@ import { updateCategoryBlacklist, } from './reducers/notifications'; import {selectPlugin} from './reducers/connections'; -import {State as Store} from './reducers/index'; +import {State as StoreState} from './reducers/index'; import textContent from './utils/textContent'; import createPaste from './fb-stubs/createPaste'; import {KeyboardActions} from './MenuBar'; +import {Store} from 'redux'; export default class Notifications< S, @@ -61,14 +62,12 @@ export default class Notifications< }; onClear = () => { - this.context.store.dispatch(clearAllNotifications()); + (this.context.store as Store).dispatch(clearAllNotifications()); }; render() { - const { - blacklistedPlugins, - blacklistedCategories, - } = this.context.store.getState().notifications; + const {blacklistedPlugins, blacklistedCategories} = (this.context + .store as Store).getState().notifications; return ( any; updatePluginBlacklist: (blacklist: Array) => any; updateCategoryBlacklist: (blacklist: Array) => any; @@ -159,13 +158,13 @@ const NoContent = styled(FlexColumn)({ color: colors.light30, }); -class NotificationsTable extends Component { +class NotificationsTable extends Component { contextMenuItems = [{label: 'Clear all', click: this.props.onClear}]; state: State = { selectedNotification: this.props.selectedID, }; - componentDidUpdate(prevProps: Props) { + componentDidUpdate(prevProps: Props & SearchableProps) { if (this.props.filters.length !== prevProps.filters.length) { this.props.updatePluginBlacklist( this.props.filters @@ -330,7 +329,7 @@ const ConnectedNotificationsTable = connect< StateFromProps, DispatchFromProps, OwnProps, - Store + StoreState >( ({ notifications: { @@ -470,9 +469,9 @@ type ItemProps = { isSelected?: boolean; inactive?: boolean; selectPlugin?: (payload: { - selectedPlugin: string | null | undefined; - selectedApp: string | null | undefined; - deepLinkPayload: string | null | undefined; + selectedPlugin: string | null; + selectedApp: string | null; + deepLinkPayload: string | null; }) => any; logger?: Logger; plugin: typeof FlipperBasePlugin | null | undefined; @@ -510,7 +509,7 @@ class NotificationItem extends Component< } state = {reportedNotHelpful: false}; - contextMenuItems; + contextMenuItems: Array<{label: string; click: (() => any) | undefined}>; deepLinkButton = React.createRef(); createPaste = () => {