Implemented strict mode for the project (broken tests, hundreds of @ts-ignore and new errors are included) [skip ci]

This commit is contained in:
ErickSkrauch
2020-01-17 23:37:52 +03:00
committed by SleepWalker
parent 10e8b77acf
commit 96049ad4ad
151 changed files with 2470 additions and 1869 deletions

View File

@@ -1,20 +1,22 @@
import React, { useContext } from 'react';
import React, { ComponentType, useContext } from 'react';
import { FormattedMessage as Message, MessageDescriptor } from 'react-intl';
import Context, { AuthContext } from './Context';
interface Props {
isAvailable?: (context: AuthContext) => boolean;
payload?: { [key: string]: any };
payload?: Record<string, any>;
label: MessageDescriptor;
}
export type RejectionLinkProps = Props;
function RejectionLink(props: Props) {
const RejectionLink: ComponentType<Props> = ({
isAvailable,
payload,
label,
}) => {
const context = useContext(Context);
if (props.isAvailable && !props.isAvailable(context)) {
if (isAvailable && !isAvailable(context)) {
// TODO: if want to properly support multiple links, we should control
// the dividers ' | ' rendered from factory too
return null;
@@ -26,12 +28,12 @@ function RejectionLink(props: Props) {
onClick={event => {
event.preventDefault();
context.reject(props.payload);
context.reject(payload);
}}
>
<Message {...props.label} />
<Message {...label} />
</a>
);
}
};
export default RejectionLink;