Skip to content

Argument of type 'Error' is not assignable to parameter of type 'Scheduler' #3672

Closed
@hassanasad

Description

@hassanasad

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
MacOS Seirra

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

angular-cli: 1.0.0-beta.24
node: 7.2.1
os: darwin x64
@angular/common: 2.4.0
@angular/compiler: 2.4.0
@angular/core: 2.4.0
@angular/forms: 2.4.0
@angular/http: 2.4.0
@angular/platform-browser: 2.4.0
@angular/platform-browser-dynamic: 2.4.0
@angular/router: 3.4.0
@angular/compiler-cli: 2.4.0

After the update to angular-cli beta 24 i started getting this error:

ERROR in ./src/app/shared/services/baseapi.service.ts
Module build failed: Error: /Users/hassan/Code/project/src/app/shared/services/baseapi.service.ts (22,20): Argument of type 'Error' is not assignable to parameter of type 'Scheduler'.
  Property 'SchedulerAction' is missing in type 'Error'.)
/Users/hassan/Code/project/src/app/shared/services/baseapi.service.ts (43,20): Argument of type 'Error' is not assignable to parameter of type 'Scheduler'.)
    at _checkDiagnostics (/Users/hassan/Code/project/node_modules/@ngtools/webpack/src/loader.js:116:15)
    at /Users/hassan/Code/project/node_modules/@ngtools/webpack/src/loader.js:141:17
 @ ./src/app/shared/services/user.service.ts 18:0-51
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi main

This is the code in context:

	httpGet( URL: string, requestOptions = this.getRequestOptions() ): Observable<any> {
		return this.http.get(URL, requestOptions)
			.retryWhen(error => error.delay(200))
			.timeout(20000, new Error('Request timeout'))   <===== LINE 22
			.map(this.extractData).catch(this.handleError);
	}

If i comment line 22 everything works fine. However, i do want to throw that error of timeout. Any suggestions please?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions