Skip to content

ajax() returns Observable<{}> instead of Observable<AjaxResponse> #1783

@billba

Description

@billba

RxJS version: 5.0.0-beta.9

Code to reproduce:

const source = Observable.ajax({ method:"GET", url: "myurl" });

Expected behavior:

Mouse over source to see that it's type Observable<AjaxResponse>

Actual behavior:

It's type Observable<{}>.

Additional information:

What might be going on is that AjaxObservable<T>.create has

      return new AjaxObservable(urlOrRequest);

and I think it should be:

      return new AjaxObservable<AjaxResponse>(urlOrRequest);

As a workaround I was able to do:

const source = Observable.ajax<AjaxResponse>({ method:"GET", url: "myurl" });

... but ajax shouldn't really take a type at all and I'm not sure why it even can.

Metadata

Metadata

Assignees

Labels

TSIssues and PRs related purely to TypeScript issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions