svi3c svi3c - 1 year ago 95
TypeScript Question

IntelliJ IDEA does not find operators of Observable in rxjs5

I just installed rxjs 5 beta 3 via

npm i rxjs@5.0.0-beta.3

I have the following example code:

import {Observable} from "rxjs"

new Observable(o => => true);

This code compiles perfectly well when using ts-node for example.

But when looking at this code inside IntelliJ IDEA, the
operator is not found.

When using operators on an Observable instance, they are not found either.

The suggested static members of

  • create()

  • if()

  • throw()

The suggested members of an instance of

  • _isScalar()

  • forEach()

  • lift()

  • subscribe()

I also tried to import only what I need, but still my IDE tells me that
does not exist on the Observable instance:

import {Observable} from "rxjs/Observable"
import "rxjs/add/operator/filter"

new Observable(o => => true);

Any suggestions how to make IntelliJ IDEA know about the operators?

Answer Source

Please, check IDEA 2016.1.2 or higher

Note: Directory node_modules must be not excluded from the project.
Otherwise, see answer

Note 2: File package.json must contain the direct dependency (or devdependency) 'rxjs'