{
"name": "data-jitsu",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.2.10",
"@angular/cdk": "^5.2.5",
"@angular/common": "5.2.7",
"@angular/compiler": "5.2.7",
"@angular/core": "5.2.7",
"@angular/forms": "5.2.7",
"@angular/http": "5.2.7",
"@angular/material": "^5.2.5",
"@angular/platform-browser": "5.2.7",
"@angular/platform-browser-dynamic": "5.2.7",
"@angular/router": "5.2.7",
"@types/youtube": "0.0.29",
"angular-froala-wysiwyg": "^2.7.2-1",
"angular2-materialize": "^15.1.10",
"angularfire2": "^4.0.0-rc0",
"core-js": "^2.4.1",
"d3": "^4.13.0",
"firebase": "^3.9.0",
"hammerjs": "^2.0.8",
"jquery": "^3.0.0",
"materialize-css": "^0.100.2",
"ngx-youtube-player": "0.0.41",
"rxjs": "^5.5.6",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "1.7.2",
"@angular/compiler-cli": "5.2.7",
"@types/bootstrap": "^3.3.36",
"@types/d3": "^4.13.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "2.6.2"
}
}
新package.json:
{
"name": "data-jitsu",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^6.0.3",
"@angular/cdk": "^6.3.1",
"@angular/common": "^6.0.3",
"@angular/compiler": "^6.0.3",
"@angular/core": "^6.0.3",
"@angular/forms": "^6.0.3",
"@angular/http": "^6.0.3",
"@angular/material": "^6.2.0",
"@angular/platform-browser": "^6.0.3",
"@angular/platform-browser-dynamic": "^6.0.3",
"@angular/router": "^6.0.3",
"@types/youtube": "^0.0.29",
"angular-froala-wysiwyg": "^2.7.2-1",
"angular2-materialize": "^15.1.10",
"angularfire2": "^5.0.0-rc.11",
"core-js": "^2.4.1",
"d3": "^4.13.0",
"firebase": "^5.0.3",
"hammerjs": "^2.0.8",
"jquery": "^3.0.0",
"materialize-css": "^0.100.2",
"ngx-youtube-player": "0.0.41",
"rxjs": "^6.2.1",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.6.8",
"@angular/cli": "~6.0.8",
"@angular/compiler-cli": "^6.0.3",
"@angular/language-service": "^6.0.3",
"@types/bootstrap": "^3.3.36",
"@types/d3": "^4.13.0",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^10.5.1",
"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-cli": "~1.0.1",
"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.7.2"
}
}
当我使用新的package.json updates运行npm install
,然后运行ng serve
时,会出现许多编译错误:
src/app/all-matches/all-matches.component.ts(35,39)中的错误:错误TS2339:类型“Observable”上不存在属性“take tile”。src/app/app.component.ts(28,39):错误TS2339:类型“Observable”上不存在属性“take tile”。src/app/authorization.service.ts(19,41):错误TS2339:类型“TypeOf Observable”上不存在属性“of”。src/app/authorization.service.ts(29,37):错误TS2339:类型“TypeOf Observable”上不存在属性“of”。src/app/authorization.service.ts(42,39):错误TS2339:类型“TypeOf Observable”上不存在属性“of”。src/app/authorization.service.ts(66,39):错误TS2339:类型“TypeOf Observable”上不存在属性“of”。src/app/authorization.service.ts(74,37):错误TS2339:类型“TypeOf Observable”上不存在属性“of”。src/app/authorization.service.ts(82,39):错误TS2339:类型“TypeOf Observable”上不存在属性“of”。src/app/database.service.ts(7,31):错误TS2305:模块‘“/users/mf/desktop/datajitsu/node_modules/angularfire2/database/index”’没有导出成员'FireBaseListObservable'。src/app/database.service.ts(7,55):错误TS2305:模块‘“/users/mf/desktop/datajitsu/node_modules/angularfire2/database/index”’没有导出成员'FirebaseObjectObservable'。src/app/match-display/match-display.component.ts(27,49):错误TS2339:属性“take tile”在类型“AngularFireObject<{}>”上不存在。src/app/new-match/new-match.component.ts(10,30):错误TS2305:模块‘“/users/mf/desktop/datajitsu/node_modules/AngularFire2/database/index”’没有导出成员'FirebaseListObservable'。src/app/new-match/new-match.component.ts(10,54):错误TS2305:模块‘“/users/mf/desktop/datajitsu/node_modules/angularfire2/database/index”’没有导出成员'FirebaseObjectObservable'。src/app/new-match/new-match.component.ts(130,37):错误TS2339:属性“switch map”在类型“Observable”上不存在。src/app/protection.guard.ts(14,34):错误TS2339:类型“Observable”上不存在属性“map”。src/app/test-db/test-db.component.ts(7,30):错误TS2305:模块‘“/users/mf/desktop/datajitsu/node_modules/AngularFire2/database/index”’没有导出成员'FirebaseListObservable'。src/app/test-db/test-db.component.ts(7,54):错误TS2305:Module“/users/mf/desktop/datajitsu/node_modules/AngularFire2/database/index”没有导出成员“FirebaseObjectObservable”。src/app/user-status-report/user-status-report.component.ts(28,39):错误TS2339:属性“take teo”在类型“observable”上不存在。src/app/user-status-report/user-status-report.component.ts(33,45):错误TS2339:属性“subscribe”在类型“AngularFireObject<{}>”上不存在。src/app/user-status-report/user-status-report.component.ts(35,56):错误TS2339:属性“take tile”在类型“AngularFireObject<{}>”上不存在。src/app/user-status-report/user-status-report.component.ts(43,66):错误TS2339:属性“take tile”在类型“AngularFireObject<{}>”上不存在。
大多数这些错误似乎都与rxjs有关,我认为这是正确的,因为我在更新中使用的是rxjs V.6,我的理解是在V.5和V.6之间有许多东西被破坏了。
我尝试安装rxjs-compatnpm install rxjs@6rxjs-compat@6--save
,我可以确认这个包除了是一个很大的增加之外,并不能解决我看到的任何错误。
根据这里和这里的建议,我还通过运行ts-lint自动化了一些更新:
npm i -g rxjs-tslint
rxjs-5-to-6-migrate -p [path/to/tsconfig.json]
没有为JavaScript文件指定有效的规则
我猜这意味着我在使用RXJS时没有使用正确的ts约定?
当谈到rxjs时,我仍然相当不称职,所以我不清楚还需要重构什么。
从“@Angulation/Core”导入{Injectable,EventEmitter};
(“找不到模块,”@Angulation/Core“)
从“firebase/app”导入*作为firebase;
(“找不到模块”,“firebase/app”)
从“@Angulation/Router”导入{Router};
(“找不到模块,”@Angulation/Router“)
import { MaterializeModule } from 'angular2-materialize'
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { masterFirebaseConfig } from './api-keys';
import { AngularFireModule } from 'angularfire2';
import { AngularFireDatabaseModule } from 'angularfire2/database';
import { AppComponent } from './app.component';
import { YoutubeComponent } from './youtube/youtube.component';
import { routing } from './app.routing';
import { NewMatchComponent } from './new-match/new-match.component';
import { CreateAccountComponent } from './create-account/create-account.component';
import { TestDbComponent } from './test-db/test-db.component';
import { LandingComponent } from './landing/landing.component';
import { MatchDisplayComponent } from './match-display/match-display.component';
import { AuthorizationService } from './authorization.service';
import { AngularFireAuthModule } from 'angularfire2/auth';
import { DatabaseService } from './database.service';
import { TextTransformationService } from './text-transformation.service';
import { ValidationService } from './validation.service';
import { LoginComponent } from './login/login.component';
import { ProtectionGuard } from './protection.guard';
import { AllMatchesComponent } from './all-matches/all-matches.component';
import { AnnotationDisplayComponent } from './annotation-display/annotation-display.component';
import { D3Service } from './d3.service';
import { NotfoundComponent } from './notfound/notfound.component';
import { UserStatusReportComponent } from './user-status-report/user-status-report.component';
import { PaymentOrAnnotationDetailsComponent } from './payment-or-annotation-details/payment-or-annotation-details.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatSelectModule } from '@angular/material/select';
import { MatOptionModule } from '@angular/material/core';
import { MatInputModule } from '@angular/material/input';
import { MatFormFieldModule } from '@angular/material';
import { MatTableModule } from '@angular/material/table';
// import { MatTreeModule } from '@angular/material';
import { MatTreeModule } from '@angular/material/tree';
import { MatSortModule } from '@angular/material';
import { MatDatepickerModule, MatNativeDateModule, MatPaginatorModule } from '@angular/material';
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
import { CdkTreeModule } from '@angular/cdk/tree';
export const firebaseConfig = {
apiKey: masterFirebaseConfig.apiKey,
authDomain: masterFirebaseConfig.authDomain,
databaseURL: masterFirebaseConfig.databaseURL,
storageBucket: masterFirebaseConfig.storageBucket
};
@NgModule({
declarations: [
AppComponent,
YoutubeComponent,
NewMatchComponent,
CreateAccountComponent,
TestDbComponent,
LandingComponent,
MatchDisplayComponent,
LoginComponent,
AllMatchesComponent,
AnnotationDisplayComponent,
NotfoundComponent,
UserStatusReportComponent,
PaymentOrAnnotationDetailsComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
routing,
MaterializeModule,
ReactiveFormsModule,
AngularFireModule.initializeApp(firebaseConfig),
AngularFireDatabaseModule,
AngularFireAuthModule,
BrowserAnimationsModule,
MatSlideToggleModule,
CdkTreeModule,
MatSelectModule,
MatOptionModule,
MatInputModule,
MatNativeDateModule,
MatDatepickerModule,
MatTableModule,
MatSelectModule,
MatSortModule,
MatProgressSpinnerModule,
MatPaginatorModule,
MatTreeModule
],
providers: [AuthorizationService, DatabaseService, ProtectionGuard, D3Service, ValidationService, TextTransformationService],
bootstrap: [AppComponent]
})
export class AppModule { }
这是回购的一个分支,包含了所有这些问题。
git clone https://html" target="_blank">github.com/Atticus29/dataJitsu.git
cd dataJitsu
git checkout version-hell-SO
npm install
ng serve
欢迎并鼓励任何疑难解答提示或直接解决导入问题的方法!
看起来您的操作符仍然以RXJS5.x的方式链接。
因此,回顾一下rxjs6中的变化:
>
导入不同。现在,您应该导入Observable、Subject、BehaviorSubject等,以及在'rxjs/add/Observable'中不同的方法。所以所有这些都必须从'rxjs'导入。例如:
必须使用管道而不是链接运算符。例如,在all-matches.components.ts的第33行中,如果替换:this.authservice.getcurrentuser().takeIte(this.ngunsubscribe).subscribe(user=>{
由
this.authservice.getCurrentUser().pipe(TakeToil(this.ngunsubscribe)).subscribe(user=>{
您可以在authorization.service.ts文件中尝试此操作。所有的“错误”都将被修复。
也许你应该检查一下这个
关于自定义文件的导入错误,请检查文件是否存在。例如:
db.list('items').subscribe(console.log)
变为(使用valueChanges方法):
db.list
不过,当我尝试使用firebase数据库时,我做了一个const来获取firebase数据库中的现有房间。get()在线:const roomRef=await database。ref()。get(); 它报告以下错误:D:/react/app/letmeask/src/pages/Home中的TypeScript错误。tsx(35,65):类型“Reference”上不存在属性“get”。TS
问题内容: 我在下面的代码块上收到此错误。 我还发现了表明存在功能的链接。 http://definitelytyped.org/docs/typescript-services-- typescriptServices/classes/typescript.stringutilities.html 我会错过一些文件吗? 问题答案: 是ES6函数,因此您需要以TypeScript编译器设置为目标,
我正在开发一个基于Firabase实时数据库的离子应用程序。当尝试启动应用程序时,im会收到此错误消息。 [ng]src/app/data-service.service.ts(14,36)中出现错误:错误TS2339:类型“{apikey:String;authDomain:String;databaseUrl:String;ProjectId:String;StorageBucket:Stri
问题内容: 我有一个非常基本的与tsx交互的程序,我收到一个错误,我无法弄清为什么 git 将此代码克隆 问题答案: 拉下您的存储库并进行检查后,我意识到您没有打字稿的反应类型。 键入是管理和安装TypeScript定义的简单方法 添加这行 并再次运行一次即可解决该问题。尝试一下,让我知道这是否可以解决您的问题:) PS:TypeScript要求您描述对象和数据的形状。如果您查看我之前提供的其他答
我尝试开始使用TypeScript 2.4.1在我的旧AngularJS项目。首先,我试图重构我的简单控制器ts。在控制器上,我在编译过程中使用匿名函数获取
我在尝试创建将keyup事件转换为可观察流时遇到问题。 我正在学习Ng书籍第6版。我被困在一个示例中,在您键入时搜索YouTube视频。当搜索返回时,我们将显示视频缩略图结果列表,以及每个视频的描述和链接。 因此,我们使用observable.from事件:https://github.com/NiLinli/ng-book2-angular-6-r68-code-samples/blob/mas