gpt4 book ai didi

angular - 在 Angular 中导入 @ngrx/core @ngrx/store 时出现问题

转载 作者:太空狗 更新时间:2023-10-29 18:19:57 25 4
gpt4 key购买 nike

我正在尝试使用 REDUX 模式构建我的下一个 Angular 应用程序,但出于某种原因我无法导入所需的库。

app.module.ts

imports: [
BrowserModule,
FormsModule,
HttpModule,
StoreModule.forRoot({
user
})
],

在新的 Angular intstall 或我原来的应用程序上,我不断收到这些错误

ERROR in 
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/models.d.ts (6,52): ',' expected.
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/models.d.ts (9,58): ',' expected.
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/models.d.ts (12,59): ',' expected.
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/models.d.ts (15,51): ',' expected.
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/models.d.ts (10,21): Generic type 'ActionReducer<T, V, Action>' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/models.d.ts (13,18): Generic type 'ActionReducerMap' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/models.d.ts (13,75): Generic type 'ActionReducer<T, V, Action>' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/models.d.ts (17,15): Generic type 'ActionReducerMap' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/models.d.ts (17,40): Generic type 'ActionReducer<T, V, Action>' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/models.d.ts (18,21): Generic type 'ActionReducerFactory<T, V, Action>' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/models.d.ts (20,20): Generic type 'ActionReducer<T, V, Action>' requires 3 type argument(s).

ERROR in C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/store_module.d.ts (15,53): ',' expected.
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/store_module.d.ts (21,40): ',' expected.
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/store_module.d.ts (22,43): ',' expected.
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/store_module.d.ts (23,43): ',' expected.
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/store_module.d.ts (12,27): Generic type 'StoreFeature<T, V, Action>' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/store_module.d.ts (17,22): Generic type 'ActionReducerFactory<T, V, Action>' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/store_module.d.ts (18,20): Generic type 'ActionReducer<T, V, Action>' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/store_module.d.ts (21,60): Generic type 'ActionReducerMap' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/store_module.d.ts (21,100): Generic type 'ActionReducerMap' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/store_module.d.ts (21,134): Generic type 'StoreConfig' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/store_module.d.ts (22,84): Generic type 'ActionReducerMap' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/store_module.d.ts (22,117): Generic type 'StoreConfig' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/store_module.d.ts (23,83): Generic type 'ActionReducer<T, V, Action>' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/store_module.d.ts (23,113): Generic type 'StoreConfig' requires 3 type argument(s).

ERROR in C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/reducer_manager.d.ts (6,68): Generic type 'ActionReducer<T, V, Action>' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/reducer_manager.d.ts (11,61): Generic type 'ActionReducer<T, V, Action>' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/reducer_manager.d.ts (16,84): Generic type 'ActionReducerMap' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/reducer_manager.d.ts (16,128): Generic type 'ActionReducerFactory<T, V, Action>' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/reducer_manager.d.ts (17,77): Generic type 'StoreFeature<T, V, Action>' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/reducer_manager.d.ts (18,26): Generic type 'StoreFeature<T, V, Action>' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/reducer_manager.d.ts (19,38): Generic type 'ActionReducer<T, V, Action>' requires 3 type argument(s).

ERROR in C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/store.d.ts (21,31): ',' expected.
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/store.d.ts (25,46): ',' expected.
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/store.d.ts (25,78): Generic type 'ActionReducer<T, V, Action>' requires 3 type argument(s).

ERROR in C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/state.d.ts (16,57): ',' expected.
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/state.d.ts (20,57): ',' expected.
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/state.d.ts (20,84): Generic type 'StateActionPair' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/state.d.ts (20,142): Generic type 'ActionReducer<T, V, Action>' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store/src/state.d.ts (20,165): Generic type 'StateActionPair' requires 3 type argument(s).

ERROR in C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store-devtools/src/reducer.d.ts (37,15): Generic type 'ActionReducer<T, V, Action>' requires 3 type argument(s).
C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store-devtools/src/reducer.d.ts (37,43): Generic type 'ActionReducer<T, V, Action>' requires 3 type argument(s).

ERROR in C:/Users/Jason/projects/NATION5/nation5/node_modules/@ngrx/store-devtools/src/config.d.ts (5,14): Generic type 'ActionReducer<T, V, Action>' requires 3 type argument(s).

有人知道这可能是什么吗?

最佳答案

我认为您正在使用旧的 angular-cli 来创建项目。

  • 将你的@angular/cli 更新到最新版本 ("@angular/cli": "^1.2.4")
  • typescript " typescript ": "~2.3.3"
  • Ngrx

    "@ngrx/core": "^1.2.0",
    "@ngrx/effects": "^4.0.1",
    "@ngrx/store": "^4.0.0",

这是我的配置,对我来说工作正常。你可以试试这个。

关于angular - 在 Angular 中导入 @ngrx/core @ngrx/store 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45447605/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com