Answer the question
In order to leave comments, you need to log in
How to add a missing required property to a type?
The program gives an error:
Свойство "onChangeFilter" отсутствует в типе "{ tickets: Tickets; filterOrder: string; }" и является обязательным в типе "{ onChangeFilter(filterOrder: string): void; }".
const mapToStateProps = ({ tickets, filterOrder }: State) => ({
tickets,
filterOrder,
});
const connector = connect(mapToStateProps);
type PropsFromRedux = ConnectedProps<typeof connector>;
function App(props: PropsFromRedux): JSX.Element {
const { tickets, filterOrder } = props;
return (
<MainScreen tickets={tickets} filterOrder={filterOrder} />
);
}
type MainScreenProps = {
tickets: Tickets;
filterOrder: string;
};
const mapDispatchToProps = (dispatch: Dispatch<Actions>) => ({
onChangeFilter(filterOrder: string) {
dispatch(changeFilter(filterOrder));
},
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question