gpt4 book ai didi

angular - node_modules/rxjs-compat/operator/shareReplay.d.ts(2,10) : error TS2305: 中的错误

转载 作者:太空狗 更新时间:2023-10-29 17:05:44 26 4
gpt4 key购买 nike

我正在尝试将一个基本的 Angular 骨架应用程序从 Angular 5 升级到 Angular 6,这是我在尝试运行该应用程序时遇到的问题:

ERROR in node_modules/rxjs-compat/operator/shareReplay.d.ts(2,10): error TS2305: Module '"C:/newAdmin/testing-front-end/admin-fe/node_modules/rxjs/internal-compatibility/index"' has no exported member 'ShareReplayConfig'.

这是我的 package.json :

{
"name": "admin-fe",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular-devkit/core": "^7.3.0",
"@angular/animations": "^6.1.0",
"@angular/common": "^6.1.0",
"@angular/compiler": "^6.1.0",
"@angular/core": "^6.1.0",
"@angular/forms": "^6.1.0",
"@angular/http": "^6.1.0",
"@angular/platform-browser": "^6.1.0",
"@angular/platform-browser-dynamic": "^6.1.0",
"@angular/router": "^6.1.0",
"@ngrx/store": "^7.2.0",
"angular-oauth2-oidc": "^5.0.2",
"core-js": "^2.5.4",
"moment": "^2.24.0",
"rxjs": "6.3.3",
"rxjs-compat": "^6.4.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.7.0",
"@angular/cli": "~6.1.3",
"@angular/compiler-cli": "^6.1.0",
"@angular/language-service": "^6.1.0",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.3.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "^2.9.1"
}
}

我在使用 typescript 3.3.1 时没有收到此错误,但我不能使用它,因为编译器只允许我使用 typescript < v2.10.0

我可以在这里采取哪些步骤?

编辑:

我将 rxjs 和 rxjs-compat 版本都调整为 6.3.3,但现在我收到以下错误:

ERROR in node_modules/@ngrx/store/src/store.d.ts(30,31): error TS2304: Cannot find name 'Extract'.

最佳答案

我有同样的问题,我不得不降级 rxjs-compat(6.3.3) 以使其与 rxjs(6.3.3) 保持一致,

在你的 package.json 中应该是这样的:

"rxjs": "6.3.3",
"rxjs-compat": "6.3.3",

如果您使用的是 rxjs 6.4.0,则不需要使用 rxjs-compat,它提供了 rxjs v6 和 v5 之间的兼容层。

所以我认为你可以直接使用 import { shareReplay } from 'rxjs/operators';

更多关于运营商的信息:https://www.learnrxjs.io/

关于angular - node_modules/rxjs-compat/operator/shareReplay.d.ts(2,10) : error TS2305: 中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54493256/

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