Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular NgRx自定义序列化程序问题-类型错误_Angular_Ngrx_Ngrx Router Store - Fatal编程技术网

Angular NgRx自定义序列化程序问题-类型错误

Angular NgRx自定义序列化程序问题-类型错误,angular,ngrx,ngrx-router-store,Angular,Ngrx,Ngrx Router Store,我正在尝试使用自定义序列化程序实现ngx路由器存储-使用他们文档中显示的代码,但我遇到以下错误: ERROR in src/app/app.module.ts(58,13): error TS2345: Argument of type '{ serializer: typeof CustomSerializer; }' is not assignable to parameter of type 'StoreRouterConfig | StoreRouterConfigFunction'.

我正在尝试使用自定义序列化程序实现ngx路由器存储-使用他们文档中显示的代码,但我遇到以下错误:

ERROR in src/app/app.module.ts(58,13): error TS2345: Argument of type '{ serializer: typeof CustomSerializer; }' is not assignable to parameter of type 'StoreRouterConfig | StoreRouterConfigFunction'.
  Object literal may only specify known properties, and 'serializer' does not exist in type 'StoreRouterConfig | StoreRouterConfigFunction'.
应用程序模块.ts

imports: [
    StoreModule.forRoot(reducers, { metaReducers }),
        RouterModule.forRoot([
            // routes
        ]),
        StoreRouterConnectingModule.forRoot({
            serializer: CustomSerializer,
        }),
        .......
       ]
export const reducers: ActionReducerMap<AppState> = {
    router: routerReducer
};
减速机/索引.ts

imports: [
    StoreModule.forRoot(reducers, { metaReducers }),
        RouterModule.forRoot([
            // routes
        ]),
        StoreRouterConnectingModule.forRoot({
            serializer: CustomSerializer,
        }),
        .......
       ]
export const reducers: ActionReducerMap<AppState> = {
    router: routerReducer
};
导出常量缩减器:ActionReducerMap

StoreRouterConnectionModule.forRoot中的config对象接受的唯一属性是stateKey。查看StoreRouterConnectionModule的forRoot方法,预期的类型是StoreRouterConfig | StoreRouterConfigFunction,如错误中所述


我不确定我是否做错了什么,有些东西我还没有实现,或者这些文档是否存在版本差异。

能否尝试清理
节点模块文件夹并进行新安装?还要确保所有的DEP都是v7

我刚刚尝试了文档中的配置,它在这里工作