我创建了一个新选择器:
const getInquiryBasicInfo = createSelector(
getMedia(getInquiryRelatedEntities, ConnectionTypes.InquiryMedia.name),
getJournalist(getInquiryRelatedEntities, ConnectionTypes.InquiryReporter.name),
getReceiveDate,
getResponsDate,
getMediaOutlet,
getInitiatedCount(getInquiryDetails),
getNumberOfPublication(getInquiryDetails),
getPrecedent(getInquiryDetails),
getMinRoleTitle(getInquiryDetails),
getLanguage,
(media, journalist ,receiveDate, responsDate, mediaOutlet, initiatedCount, numberOfPublication ,isPrecedent,role, languages) => {
return [media,journalist,receiveDate, responsDate, mediaOutlet, initiatedCount,numberOfPublication,isPrecedent ,role, languages].filter(info => {
return info.value.length;
});
}
);
我得到了这个错误:
error TS2554: Expected 2-9 arguments, but got 11.
如何使用9个以上参数的createSelector函数?我使用angular 8,我使用:{createSelector } from '@ngrx/store';
谢谢你的帮助!
发布于 2019-07-02 19:50:45
根据我的理解,它应该后退到一个允许所有选择器的后备选择器:
export function createSelector(
...input: any[]
): MemoizedSelector<any, any> | MemoizedSelectorWithProps<any, any, any> {
return createSelectorFactory(defaultMemoize)(...input);
}
也就是说,拥有如此大的选择器通常是一种糟糕的做法,您应该将它们拆分成多个较小的选择器。
https://stackoverflow.com/questions/56850465
复制相似问题