Skip to content

Deprecating MapTo variants. #6399

Closed
Closed

Description

@benlesh

Based off of a comment here

At one point, there was some performance advantage to having mapTo, concatMapTo, switchMapTo, et al. Because they introduced a way to map to the same value over and over again, without introducing a closure.

Now:

  1. Closures are much faster.
  2. Therefor the whole library is written in such a way that is uses closures.

Considering that mergeMapTo(x) and mergeMap(() => x) do pretty much the same thing, only one is hiding the closure, I thikn we should deprecate the MapTo variants to help clean up the core API.

Activity

  1. added
    8.xIssues and PRs for version 8.x
    AGENDA ITEMFlagged for discussion at core team meetings
    on May 12, 2021
  2. backbone87 commented on May 12, 2021

    @backbone87
    Contributor

    some usages experience a decrease in ergonomy:

    mapTo(new Foo());
    // vs
    const foo = new Foo();
    map(() => foo);
    // vs
    map(((foo) => () => foo)(new Foo()));

    personally, I have used this behavior on a few occasions. this isn't a big deal, just wanted to make sure this case is considered.

  3. benlesh commented on May 19, 2021

    @benlesh
    MemberAuthor

    Core Team meeting:

    👍 to deprecate
    ❓ Maybe not remove until version 9 (@kwonoj)

  4. removed
    AGENDA ITEMFlagged for discussion at core team meetings
    on May 19, 2021
  5. sod commented on Jul 2, 2021

    @sod

    This is genius. The documentation becomes easier to digest for newcomers and operators are easier to discover. And push developers into writing their first operator themself to harness the full potential of rxjs, as @backbone87 already mentioned, having a mapTo is kinda useful :)

  6. added a commit that references this issue on Mar 4, 2022
    6a6798e
  7. added a commit that references this issue on Jul 15, 2025
    45a22e2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    8.xIssues and PRs for version 8.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions