Exploit Exploit - 1 month ago 12
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

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.

Comments