Triggering side effects isn’t what makes code imperative vs declarative.
James DiGioia
1

Here’s the definition of “declarative programming” from Wikipedia:

Declarative programming : is a programming paradigm that expresses the logic of a computation(What do) without describing its control flow(How do)

Specifically:

Many languages that apply this style attempt to minimize or eliminate side effects by describing what the program must accomplish in terms of the problem domain, rather than describe how to accomplish it as a sequence of the programming language primitives[2]

And again:

Any programming language that lacks side effects (or more specifically, is referentially transparent)

To be even more specific:

Declarative programming is a non-imperative style of programming in which programs describe their desired results without explicitly listing commands or steps that must be performed

To me .mergeMap(() => getJSON()) is “listing the commands or steps” to be performed in the outside world.

Contrary to what you stated, side-effects and declarative programming are very much related concepts.

Like what you read? Give Luca Matteis a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.