我创建了一个新的选择器:
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.
如何将createSelector函数与9个以上的参数一起使用?
我用角8
而我使用了:{createSelector } from '@ngrx/store';
感谢您的帮助!
答案 0 :(得分:0)
据我了解,它应该回退到允许所有选择器的回退选择器:
export function createSelector(
...input: any[]
): MemoizedSelector<any, any> | MemoizedSelectorWithProps<any, any, any> {
return createSelectorFactory(defaultMemoize)(...input);
}
话虽这么说,选择器这么大通常是一个坏习惯,您应该将它们拆分为多个较小的选择器。