Skip to content

Incorrect type checking in catch operator #3052

Closed
@Roaders

Description

RxJS version:
RXJS Version: 5.1.0

Code to reproduce:

interface Action = {
    type: string;
}

function loadTasks(){
    return this.service.load()
      .map<any[],Action>(_ => ({type:"TASKS_LOADED"}))
      .catch<Action,Action>((e: any) => Observable.of({broken:"True"}))
}

Expected behavior:
Given code should throw an error as {broken:"True"} cannot be converted to an Action

Actual behavior:
No Errors, code compiles fine

Additional information:
If I change the code to:

function loadTasks(){
    return this.service.load()
      .map<any[],Action>(_ => ({type:"TASKS_LOADED"}))
      .catch<Action,Action>((e: any) => Observable.of<Action>({broken:"True"}))
}

I get the expected error.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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