From 29326519b8620a994f84bc81beb032e3747fe6c9 Mon Sep 17 00:00:00 2001 From: SleepWalker Date: Wed, 20 May 2020 19:59:06 +0300 Subject: [PATCH] Upgrade ts to the latest version and fix type errors --- package.json | 2 +- .../components/accounts/AccountSwitcher.tsx | 4 ++-- .../app/components/auth/PanelTransition.tsx | 2 +- packages/app/components/auth/actions.ts | 2 +- .../app/components/footerMenu/FooterMenu.tsx | 4 +++- .../languageSwitcher/LanguageList.tsx | 2 +- .../profile/changeEmail/ChangeEmail.tsx | 2 +- packages/app/components/ui/Panel.tsx | 2 +- packages/app/components/ui/form/Dropdown.tsx | 2 +- .../app/components/ui/form/LinkButton.tsx | 10 +++++----- .../components/ui/popup/PopupStack.test.tsx | 20 +++++++++---------- .../app/components/ui/popup/PopupStack.tsx | 2 +- packages/app/services/authFlow/AuthFlow.ts | 2 +- packages/app/services/i18n/i18n.ts | 9 +++------ tsconfig.json | 1 + yarn.lock | 8 ++++---- 16 files changed, 37 insertions(+), 37 deletions(-) diff --git a/package.json b/package.json index 33b5403..81fb643 100644 --- a/package.json +++ b/package.json @@ -163,7 +163,7 @@ "speed-measure-webpack-plugin": "^1.3.3", "storybook-addon-intl": "^2.4.1", "style-loader": "~1.2.1", - "typescript": "^3.7.4", + "typescript": "^3.9.3", "unexpected": "^11.14.0", "unexpected-sinon": "^10.5.1", "url-loader": "^4.1.0", diff --git a/packages/app/components/accounts/AccountSwitcher.tsx b/packages/app/components/accounts/AccountSwitcher.tsx index 09675a0..cca5873 100644 --- a/packages/app/components/accounts/AccountSwitcher.tsx +++ b/packages/app/components/accounts/AccountSwitcher.tsx @@ -169,7 +169,7 @@ export class AccountSwitcher extends React.Component { ); } - onSwitch = (account: Account) => (event: React.MouseEvent) => { + onSwitch = (account: Account) => (event: React.MouseEvent) => { event.preventDefault(); loader.show(); @@ -184,7 +184,7 @@ export class AccountSwitcher extends React.Component { .finally(() => loader.hide()); }; - onRemove = (account: Account) => (event: React.MouseEvent) => { + onRemove = (account: Account) => (event: React.MouseEvent) => { event.preventDefault(); event.stopPropagation(); diff --git a/packages/app/components/auth/PanelTransition.tsx b/packages/app/components/auth/PanelTransition.tsx index 1dbef95..6279498 100644 --- a/packages/app/components/auth/PanelTransition.tsx +++ b/packages/app/components/auth/PanelTransition.tsx @@ -406,7 +406,7 @@ class PanelTransition extends React.PureComponent { }); }; - onGoBack: MouseEventHandler = (event): void => { + onGoBack: MouseEventHandler = (event): void => { event.preventDefault(); authFlow.goBack(); }; diff --git a/packages/app/components/auth/actions.ts b/packages/app/components/auth/actions.ts index 99ef213..a18ef0b 100644 --- a/packages/app/components/auth/actions.ts +++ b/packages/app/components/auth/actions.ts @@ -680,7 +680,7 @@ function validationErrorsHandler( repeatUrl?: string, ): ( resp: Resp<{ - errors?: Record; + errors?: Record; data?: Record; }>, ) => Promise { diff --git a/packages/app/components/footerMenu/FooterMenu.tsx b/packages/app/components/footerMenu/FooterMenu.tsx index e4369dc..5d1bb37 100644 --- a/packages/app/components/footerMenu/FooterMenu.tsx +++ b/packages/app/components/footerMenu/FooterMenu.tsx @@ -11,7 +11,9 @@ import messages from './footerMenu.intl.json'; const FooterMenu: ComponentType = () => { const dispatch = useDispatch(); - const onLanguageSwitcherClick = useCallback( + const onLanguageSwitcherClick = useCallback< + MouseEventHandler + >( (event) => { event.preventDefault(); dispatch(createPopup({ Popup: LanguageSwitcher })); diff --git a/packages/app/components/languageSwitcher/LanguageList.tsx b/packages/app/components/languageSwitcher/LanguageList.tsx index 0d977fc..4c0ea39 100644 --- a/packages/app/components/languageSwitcher/LanguageList.tsx +++ b/packages/app/components/languageSwitcher/LanguageList.tsx @@ -124,7 +124,7 @@ export default class LanguageList extends React.Component<{ return emptyCaptions[Math.floor(Math.random() * emptyCaptions.length)]; } - onChangeLang(lang: string): MouseEventHandler { + onChangeLang(lang: string): MouseEventHandler { return (event) => { event.preventDefault(); diff --git a/packages/app/components/profile/changeEmail/ChangeEmail.tsx b/packages/app/components/profile/changeEmail/ChangeEmail.tsx index f9513ca..fd2f81b 100644 --- a/packages/app/components/profile/changeEmail/ChangeEmail.tsx +++ b/packages/app/components/profile/changeEmail/ChangeEmail.tsx @@ -313,7 +313,7 @@ export default class ChangeEmail extends React.Component { return this.state.activeStep + 1 === STEPS_TOTAL; } - onSwitchStep = (event: React.MouseEvent) => { + onSwitchStep = (event: React.MouseEvent) => { event.preventDefault(); this.nextStep(); diff --git a/packages/app/components/ui/Panel.tsx b/packages/app/components/ui/Panel.tsx index c77cc67..2a59cdf 100644 --- a/packages/app/components/ui/Panel.tsx +++ b/packages/app/components/ui/Panel.tsx @@ -103,7 +103,7 @@ export class PanelBodyHeader extends React.Component< ); } - onClose = (event: React.MouseEvent) => { + onClose = (event: React.MouseEvent) => { event.preventDefault(); const { onClose } = this.props; diff --git a/packages/app/components/ui/form/Dropdown.tsx b/packages/app/components/ui/form/Dropdown.tsx index 4002f50..b6cfc57 100644 --- a/packages/app/components/ui/form/Dropdown.tsx +++ b/packages/app/components/ui/form/Dropdown.tsx @@ -100,7 +100,7 @@ export default class Dropdown extends FormInputComponent { }); } - onSelectItem(item: OptionItem): MouseEventHandler { + onSelectItem(item: OptionItem): MouseEventHandler { return (event) => { event.preventDefault(); diff --git a/packages/app/components/ui/form/LinkButton.tsx b/packages/app/components/ui/form/LinkButton.tsx index b1bb795..b078364 100644 --- a/packages/app/components/ui/form/LinkButton.tsx +++ b/packages/app/components/ui/form/LinkButton.tsx @@ -3,16 +3,16 @@ import { Link } from 'react-router-dom'; import Button from './Button'; -export default function LinkButton( - props: React.ComponentProps & - React.ComponentProps, -) { +type ButtonProps = React.ComponentProps; +type LinkProps = React.ComponentProps; + +export default function LinkButton(props: ButtonProps & LinkProps) { const { to, ...restProps } = props; return (