2

rxjs を 6.1.0 にアップデートしました。そして、インポートを新しいスタイルにリファクタリングしたいと思います。つまり:

import { Observable, of } from 'rxjs';

しかし、これは私にエラーを与えました:

// return Observable.of(data); 
error TS2339: Property 'of' does not exist on type 'typeof Observable'.

map import wokrs (だと思います)

import { map } from 'rxjs/operators';

return this.http.post(url, data).pipe(
    map(res => res)
)

私は何をすべきか?

依存関係も追加します

"@agm/core": "1.0.0-beta.2",
"@angular/animations": "^6.0.0",
"@angular/common": "^6.0.0",
"@angular/compiler": "^6.0.0",
"@angular/core": "^6.0.0",
"@angular/forms": "^6.0.0",
"@angular/http": "^6.0.0",
"@angular/platform-browser": "^6.0.0",
"@angular/platform-browser-dynamic": "^6.0.0",
"@angular/router": "^6.0.0",
"brace": "0.11.0",
"codemirror": "5.33.0",
"core-js": "^2.5.4",
"dragula": "3.7.2",
"moment": "2.20.1",
"ngx-quill": "2.0.4",
"rxjs": "^6.1.0",
"rxjs-compat": "^6.1.0",
"spinkit": "1.2.5",
"ts-helpers": "1.1.2",
"zone.js": "^0.8.26"

そして私のdevDependencies

"@angular-devkit/build-angular": "~0.6.0",
"@angular/cli": "~6.0.0",
"@angular/compiler-cli": "^6.0.0",
"@angular/language-service": "^6.0.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": "~1.4.2",
"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"
4

2 に答える 2

-2

の現在:

import { of } from 'rxjs/observable/of';
于 2018-05-17T17:59:33.170 に答える