当我编译时,我在RxJS声明文件中得到以下编译器错误:
node_modules/rxjs/Subject.d.ts(16,22): error TS2415: Class 'Subject<T>' incorrectly extends base class 'Observable<T>'.
Types of property 'lift' are incompatible.
Type '<R>(operator: Operator<T, R>) => Observable<T>' is not assignable to type '<R>(operator: Operator<T, R>) => Observable<R>'.
Type 'Observable<T>' is not assignable to type 'Observable<R>'.
Type 'T' is not assignable to type 'R'.
Run Code Online (Sandbox Code Playgroud)
这里发生了什么,如何在不降级到TypeScript 2.3或更早版本的情况下解决这个问题?
#这是我现在面临的错误:
我使用npm(https://github.com/shripalsoni04/nativescript-angular-drawer-template)下载了导航抽屉样本.但它会出现以下错误.
dhrn@dhrn-Inspiron-5548:~/NativeApp/Supervisor$ tns run android
Searching for devices...
iTunes is not available for this operating system. You will not be able to work with connected iOS devices.
Executing before-prepare hook from /home/dhrn/NativeApp/Supervisor/hooks/before-prepare/nativescript-dev-typescript.js
Found peer TypeScript 2.4.1
node_modules/rxjs/Subject.d.ts(16,22): error TS2415: Class 'Subject<T>' incorrectly extends base class 'Observable<T>'.
Types of property 'lift' are incompatible.
Type '<R>(operator: Operator<T, R>) => Observable<T>' is not assignable to type '<R>(operator: Operator<T, R>) => Observable<R>'.
Type 'Observable<T>' is not assignable to type 'Observable<R>'.
Type …Run Code Online (Sandbox Code Playgroud) typescript nativescript angular2-nativescript nativescript-telerik-ui
我有一个简单的服务,内容如下:
import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import 'rxjs/add/observable/throw';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/map';
import { Observable } from 'rxjs/Observable';
@Injectable()
export class AddressService {
constructor(private http: Http) { }
getAnything = (): Observable<Response> => {
return this.http.get('https://my_api.com')
.map(this.handleSuccess)
.catch(this.handleError);
}
handleError = (error: Response): Observable<Response> => {
return Observable.throw(error || 'Server Error');
}
handleSuccess = (response: Response): Observable<Response> => {
let body;
if (response.text()) {
body = response.json();
}
return body || {}; …Run Code Online (Sandbox Code Playgroud) 我有一个Angular应用程序,它完美地运行.但是,使用后升级依赖项后yarn upgrade,我得到了这个神秘的错误:
main.bundle.js:6779 Uncaught TypeError: Object.setPrototypeOf called on null or undefined
at setPrototypeOf (<anonymous>)
at webpackJsonp.../../../../../src/ui-components/src/components/phone-number-input/phone-number-input.component.ts.__extends (main.bundle.js:6779)
at phone-number-input.component.ts:24
at Object.../../../../../src/ui-components/src/components/phone-number-input/phone-number-input.component.ts (phone-number-input.component.ts:69)
at __webpack_require__ (bootstrap 8652e46ce92ee05aa5a3:54)
at Object.../../../../../src/ui-components/src/components/phone-number-input/phone-number-input.module.ts (phone-number-input.component.ts:24)
at __webpack_require__ (bootstrap 8652e46ce92ee05aa5a3:54)
at Object.../../../../../src/ui-components/src/ui-components.module.ts (roman-numeral.pipe.ts:10)
at __webpack_require__ (bootstrap 8652e46ce92ee05aa5a3:54)
at Object.../../../../../src/app/app.module.ts (app.component.ts:31)
webpackJsonp.../../../../../src/ui-components/src/components/phone-number-input/phone-number-input.component.ts.__extends @ main.bundle.js:6779
(anonymous) @ phone-number-input.component.ts:24
../../../../../src/ui-components/src/components/phone-number-input/phone-number-input.component.ts @ phone-number-input.component.ts:69
__webpack_require__ @ bootstrap 8652e46ce92ee05aa5a3:54
../../../../../src/ui-components/src/components/phone-number-input/phone-number-input.module.ts @ phone-number-input.component.ts:24
__webpack_require__ @ bootstrap 8652e46ce92ee05aa5a3:54
../../../../../src/ui-components/src/ui-components.module.ts @ roman-numeral.pipe.ts:10
__webpack_require__ @ bootstrap 8652e46ce92ee05aa5a3:54
../../../../../src/app/app.module.ts @ app.component.ts:31
__webpack_require__ @ bootstrap 8652e46ce92ee05aa5a3:54
../../../../../src/main.ts …Run Code Online (Sandbox Code Playgroud) 为了防止downvotes,我将lorem-ipsum详细说明此错误消息:
我正在使用angular4和蓝色(实际上它今天相当灰)这个错误发生了.有人可以帮忙吗?我已经在github上发现了类似的问题,但没有解决问题的答案(我尝试过"npm update"和"npm install")
打字稿版本是2.4.0
其他错误消息是:
类'WebSocketSubject'错误地扩展了基类'AnonymousSubject'
物业'电梯'的类型是不相容的.
原始错误区域的位置为"./node_modules/rxjs/Subject.d.ts".