RxJS version:
5.5.2
Code to reproduce:
like renamed operators in rxjs/operators
Mind share bit more details?
ha, of is a reserved word in JavaScript
In my Angular app I could have code looking like this
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import { Observable } from 'rxjs/Observable';
or this
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { of } from 'rxjs/observable/of';
import { catchError, share, tap } from 'rxjs/operators';
import { Observable } from 'rxjs/Observable';
Editor colorization for of as a function treats it like the of keyword in js. In my color theme in VSCode, of is blue like this and true whereas my other functions are yellow. Slightly confusing and can be dealt with as @Brooooooklyn said by using an alias like with tap and catchError.
Wow this is an amusing one. While of is _not_ a keyword it is a built in, for use in for of loops. You can do some silly things with the fact that of can be assigned. It doesn't change the semantics of a for(x of ...) though.
> var of = "yep"
undefined
> for(y of [1,2,3]) { console.log(y) }
1
2
3
undefined
> of
'yep'
since of is a valid variable name:
> of = [1,2,3]
[ 1, 2, 3 ]
> for(of of of) { console.log(of) }
1
2
3
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Wow this is an amusing one. While
ofis _not_ a keyword it is a built in, for use infor ofloops. You can do some silly things with the fact thatofcan be assigned. It doesn't change the semantics of afor(x of ...)though.since of is a valid variable name: