Angular NgRx自定义序列化程序问题-类型错误
我正在尝试使用自定义序列化程序实现ngx路由器存储-使用他们文档中显示的代码,但我遇到以下错误: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'.
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
我刚刚尝试了文档中的配置,它在这里工作