The short answer is "You can skip the pipe, but you shouldn't" because the pipe
operator is not mandatory prior to version 6.0 as mentioned by martin in the comments (so version < 6 is not a must), and if you include rxjs-compact
you can use the old way of chaining operators (so you can actually use the old way everywhere up to the latest 6. version).
Lets dive a bit on the part: "Why you shouldn't use it"
Since version 5.5 the pipe operator is avaliable (but not mandatory) for usage and is usually preferred, because (back then) we all knew that in the next versions all operators will be wrapped in pipe
, so you can think about that period 5.5<=6 like a migration window, to the new way.
Although we are now at version 6+ and the usage of pipe
is the default behaviour, rxjs still supports the old chaining (no pipe
) as long as you also install rxjs-compat
.
So the answer is: If you are using rxjs 5.5+
, and you want to make use of tree shaking and write readable code by the new standard (as mentioned by cartant in the comments)?
"You must always use pipe".
pipe()
is the only way of using any number of operators. What you have withsomeObservable.map
is the old "patch" style of operators that is now deprecated. github.com/ReactiveX/rxjs/blob/master/doc/pipeable-operators.md – Cuthburtmap(mappingLogicMethod)(someObservable).subscribe(x => console.log(x));
– Aligarh