首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用beta6编译错误

使用beta6编译错误
EN

Stack Overflow用户
提问于 2016-05-03 19:43:58
回答 1查看 1.7K关注 0票数 3

使用rxjs beta2,我的项目工作得很好,但是更新到beta6会得到一长串编译错误列表:

代码语言:javascript
运行
复制
component.ts(34,18): error TS2339: Property 'finally' does not exist on type 'Observable<T[]>'.
....
....
.component.ts(51,10): error TS2339: Property 'switchMap' does not exist on type 'Observable<Company>'.
....
....
service.ts(24,18): error TS2339: Property 'map' does not exist on type 'Observable<Response>'
....
....
node_modules/rxjs/add/observable/range.d.ts(2,16): error TS2435: Ambient modules cannot be nested in other modules.
node_modules/rxjs/add/observable/range.d.ts(2,16): error TS2436: Ambient module declaration cannot specify relative module name.
node_modules/rxjs/add/operator/catch.d.ts(2,16): error TS2435: Ambient modules cannot be nested in other modules.
node_modules/rxjs/add/operator/catch.d.ts(2,16): error TS2436: Ambient module declaration cannot specify relative m
..

我在进口这样的可观察仪器:

代码语言:javascript
运行
复制
import {Observable} from 'rxjs/Observable';

我做错了什么?

非常感谢

使用rc1 rxjs beta6工作来编辑。但我不得不把结果投给我所有的观察对象。在我能用上之前

代码语言:javascript
运行
复制
this._couseSourcesSvc.readAll ()
    .finally (() => sourcesSpinner.hide ())
    .subscribe (
        res => {
            this.sources = res;
        }

但现在我得用:

代码语言:javascript
运行
复制
this._couseSourcesSvc.readAll ()
    .finally (() => sourcesSpinner.hide ())
    .subscribe (
        (res:Sources[]) => {
            this.sources = res;
        }

如您所见,我必须强制转换结果,否则将得到一个编译错误(res:Sources[])

代码语言:javascript
运行
复制
Type '{}' is not assignable to type 'DocumentSource[]'.

这是正常的吗?

EN

回答 1

Stack Overflow用户

发布于 2016-05-03 19:46:03

只有Angular2 rc.0 (昨晚刚刚发布)支持rx 6。

升级您的角度,以释放候选1,以便能够更新RxJ。

注意,您必须将您的导入更新为@angular/core@angular/http等。名称已从angular2/*更改

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37013041

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档