我正在尝试使用自定义序列化程序来实现 ngx-router-store - 使用他们在此处的文档中显示的代码,但我收到以下错误:
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'.
app.module.ts
imports: [
StoreModule.forRoot(reducers, { metaReducers }),
RouterModule.forRoot([
// routes
]),
StoreRouterConnectingModule.forRoot({
serializer: CustomSerializer,
}),
.......
]
减速器/index.ts
export const reducers: ActionReducerMap<AppState> = {
router: routerReducer
};
我正在使用路由器商店版本 7.1.0:
StoreRouterConnectingModule.forRoot 中的配置对象接受的唯一属性是 stateKey。查看 StoreRouterConnectingModule 的 forRoot 方法,预期的类型是 StoreRouterConfig | 错误中详述的 StoreRouterConfigFunction。
我不确定我是否做错了什么,有些东西我没有实现,或者文档是否存在版本差异。