@GaserV

Как типизировать redux connected & React.memo компонент?

Как типизировать redux connected & React.memo компонент?

interface OwnProps {
    a: SomeType;
    b: SomeType;
}

interface StateProps {
    c: SomeType;
    d: SomeType;
}

type Props = OwnProps & StateProps;

const SomeComponent: React.FC<Props> = (props) => {}

const mapStateToProps = state => ({
   c: 'value',
   d: 'value'
})

const connected = connect(mapStateToProps)(SomeComponent);

const areEqual = (prev: Props, next: Props) => {...};

export default React.memo(connected, areEqual);


TS ругается на areEqual:
Type 'Readonly & OwnProps>' is missing the following properties from type 'StateProps': c, d

Подскажите, как исправить?
  • Вопрос задан
  • 124 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы