gpt4 book ai didi

javascript - 导致错误的reduce函数

转载 作者:行者123 更新时间:2023-11-28 05:45:22 24 4
gpt4 key购买 nike

chrome 控制台中显示的错误:

1. http://localhost:3000/vendor/@ngrx/store/index.js
Failed to load resource: the server responded with a status of 404 (Not Found)

2. localhost/:19 Error: Error: XHR error (404 Not Found)
loading http://localhost:3000/vendor/@ngrx/store/index.js(…)
(anonymous function) @ localhost/:19

reducer .ts:*我找不到something1返回值类型和状态类型的适当类型。

import { Action} from '@ngrx/store';
export const something1 = (state: any = {}, action:Action) => {
switch (action.type) {
default:
return state;
}
};

main.ts:删除“provideStore({something1})”将导致应用程序正常运行

import { bootstrap }    from '@angular/platform-browser-dynamic';
import { AppComponent } from './app.component';
import { disableDeprecatedForms, provideForms } from '@angular/forms';
import {AccountService} from "./account.service";
import {provideStore} from '@ngrx/store';
import {something1} from "./reducer";

bootstrap(AppComponent, [
AccountService,
disableDeprecatedForms(),
provideForms(),
provideStore({something1})
])
.catch((err: any) => console.error(err));

最佳答案

解决了!

我在 systemjs.config.js 内将“@ngrx”的值从 vendor/@ngrx更改为“node_modules/@ngrx”。

关于javascript - 导致错误的reduce函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38573011/

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