【问题标题】:Type 'Dictionary<T>' has no call signature. TypeScript, ngRx类型 'Dictionary<T>' 没有调用签名。打字稿,ngRx
【发布时间】:2021-05-20 19:55:50
【问题描述】:

我正在尝试使用 ngRx 准备信用卡申请。我已经设置了我的操作、减速器和效果,但是在我的减速器结束时,当我尝试访问信用卡 ID 时,我遇到了上述错误。错误是实体没有回调。

    export const getCurrentCreditCard = createSelector(
    getCreditCardFeatureState,
    getCurrentCreditCardId,
    state => state.entities(state.selectedCreditCardId)
    );

代码有点多...请这里是 git repo 的链接。 https://github.com/ProgrammeMitch/credit_card_store_ngrx 请帮忙

【问题讨论】:

    标签: angular typescript rxjs ngrx


    【解决方案1】:

    我对ngrx不太熟悉,但是错误似乎表明state.entities不是方法,而是Dictionary

    我想也许你只需要使用方括号:

    state => state.entities[state.selectedCreditCardId]
    

    【讨论】:

      猜你喜欢
      • 2018-12-15
      • 1970-01-01
      • 1970-01-01
      • 2018-07-19
      • 2019-05-23
      • 2018-04-27
      • 2020-07-10
      • 1970-01-01
      • 2019-04-26
      相关资源
      最近更新 更多