Exploit Exploit - 1 year ago 164
TypeScript Question

RxJS Subject gives me a (SystemJS) Unexpected token <(…)

I got this typescript code:

_live: Subject<Match[]> = new BehaviorSubject<Match[]>(null);
_pre: Subject<Match[]> = new BehaviorSubject<Match[]>(null);

But I keeps getting this Error:

(SystemJS) Unexpected token <(…).

When those 2 variables are removed everything else works fine. Is there a fix for this or something else that replace Subject?

Answer Source

Try importing Subject like this-

import { Subject }          from 'rxjs/Subject';

or import everything from RxJS like this-

import 'rxjs/Rx'; 
// adds ALL RxJS statics & operators to Observable

See if this helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download