我正在为其依赖于ngrx存储的角8组件编写单元测试。我在ngOnInit函数中有多个选择器。我想使用overrideSelector方法来模拟这些选择器。
目前,我面临以下问题:
如果我试图使用像下面这样的No overload matches this call. Overload 1 of 3, '(selector: string, value: AuthData): MemoizedSelector<string, AuthData, DefaultProjectorFn<AuthData>>', gave the following error
我正在尝试与Angular、Jest和Spectator一起编写单元测试。现在我正在努力模仿NgRx商店。当我试图从旁观者实例中获取NgRx提供的MockStore的实例时,我得到了一个"No provider for MockStore“错误。
我已经阅读了关于模拟和单元测试的NgRx文档,通过阅读文档,我能够在不使用观察者的情况下模拟NgRx商店,我试着在谷歌上四处寻找帮助,但似乎找不到与观察者一起模拟NgRx商店的例子,我已经在NgRx/store Gitter上留言,看看是否有人能够帮助我。
下面是我的代码:
let component: MyComponent;
我正在使用来自@ngrx/store的@ngrx/store来从我的商店中选择一个对象数组。
我的应用程序编译,但是我得到了错误。
Argument of type 'MemoizedSelector<ICommonAppState, IMenuItemsObject[]>' is not assignable to parameter of type 'string'.
navigation.selectors.ts
import { createSelector } from '@ngrx/store';
import { RED
我正在尝试访问我的Angular 5项目中的ngrx效果中的部分商店。根据StackOverflow上的几个帖子,以及几篇博客文章,我正在使用withLatestFrom和我的注入商店。我目前使用的是Angular 5、ngrx 4.1.1和rxjs 5.5.2
我的问题是,我一直收到一个类型错误:
error TS2339: Property 'withLatestFrom' does not exist on type 'Actions<Action>'.
这是我正在使用的代码。有没有想过这可能是什么原因造成的?
import {Injectab
我试图采用现有的ngrx状态并将其重构为子特性modules.The问题是当我在我的功能模块导入中使用StoreModule.forFeature时.我在编译过程中遇到了一个错误:
ERROR in [at-loader] ./src/app/components/login/login.module.ts:67:21
TS2339: Property 'forFeature' does not exist on type 'typeof StoreModule'.
实际上,我在node_modules/@ngrx/store中搜索了"forFeatur
我目前的项目是使用角/ngrx 7,我计划升级到最新的版本8。
我的项目是一个带有演示应用程序的角库,它是角域的典型样式。
为了升级我的项目,我在网上发布了一些关于相关主题的帖子:
升级角
ng update @angular/cli @angular/core --force
这一步我必须添加--force参数来强制升级。
升级Ngrx
ng update @ngrx/store
在这个步骤中,我得到了许多类似于下面的警告消息:
NgRx 8 Migration: Unable to run the schematics to rename \`META_REDUCERS\` to \`US
错误的意思是,它在action参数之后在.map中使用逗号。
在DataActions.AddDataAction上盘旋时也有一个错误,上面写着Tuple type '[Action, AppStore]' with length '2' cannot be assigned to tuple with length '5'
@Effect() addData$ = this.actions$
.ofType(DataActions.ADD_DATA)
.withLatestFrom(this.store$)
.map((
我怎么才能把这事做好?
switchMap((value: number) => throwError(value)
.pipe(
customeErrorHandler((value: number) => value * 3)
);
);
export const customErrorHandler = (function: Function) =>
catchError() => of( the function passed as parameter evaluated with the value );
不将函数和值作为单独的参数传递是
我在angular2应用中实现了@ngrx,当我试图编译typescript项目时,我得到了下面的错误。
Error:(40, 20) TS2339:Property 'map' does not exist on type 'string | Book | Book[]'. Property 'map' does not exist on type 'string'.
我认为这个错误与ngrx示例应用程序中使用的typescript的联合类型有关