English 中文(简体)
类型说明
原标题:Typescript Angular NGRX/Effects actions$.pipe() undefined

Hello I have issue with ngrx/effects - pipe undefined. Below I attached sample code which is correct along compilator but browser shows undefined pipe error.

constructor(
    private actions$: Actions,
    private ethereumService: EthereumService
) { }

loadUser$ = createEffect(() =>
    this.actions$.pipe(
        ofType(loadAccountState),
        mergeMap(() => this.ethereumService.getAccountDetails()
            .pipe(
                map(setAccountStateCompleted),
                catchError(() => EMPTY)
            )
        )
    )
);

附录:

StoreModule.forRoot(reducers),
EffectsModule.forRoot([AccountEffects]),

EDIT:即使是这种样本也存在同样的错误——-

logActions$ = createEffect(() =>
    this.actions$.pipe(
        ofType(AccountActions.loadAccountState),
        tap(action => console.log(action))
    ), { dispatch: false });

PS2。 我正在使用<条码>。 地图,是作为<条码>进口到根基的主要减量文档

import {
  createSelector,
  createFeatureSelector,
  ActionReducerMap,
} from  @ngrx/store ;

import * as fromAccount from  ./account.reducer ;

export interface State {
  account: fromAccount.State;
}

export const reducers: ActionReducerMap<State> = {
  account: fromAccount.updateAccountReducer,
};

export const selectAccountState = createFeatureSelector<fromAccount.State>( account );

//Account Selectors
export const selectCurrentUser = createSelector(
  selectAccountState,
  fromAccount.selectActiveAccount
);

我的法典有什么错误,请帮助

问题回答

视<代码> 交易额的申报情况,生成的代码在设定目标ES2022或新方向时可能会发生变化。

快速解决方案——在<条码>中添加:

"compilerOptions": {
  {
    // ...
    "useDefineForClassFields": false
    // ...
  }
}

将来,你可能希望重新确定分类,避免这一旗帜。

更多信息:

在将汇编者目标转换为ES2022时,如果一些Jest测试失败,这个问题也会发生。

I fixed this problem by updating my tsconfig.json file to reference ES2020 instead of ESNEXT.
tsconfig keys

经过这一更新,我在影响档案中掌握了在施工者之外、为我工作的各种产生效果的方法。

单元15

actions$ = inject(Actions);

when the lib is set to ES2022 in your tsconfig





相关问题
Angular matSort not working on Date column by desc

Trying to sort the material table with date column , date format is MM/DD/YYYY ,h:mm A , order of date is not by latest date and time. Anything which i missed from the below stackblitz code. https:/...

热门标签