# Argumentos resultSelector

Algunos operadores podían utilizarse con un argumento `resultSelector` Some operator supported a resultSelector argument that acted as mapping function on the result of that operator. The same behavior can be reproduced with the map operator, therefore this argument became deprecated.

> Este cambio se introdujo en RxJS 6.0 y será *breaking* en RxJS 8.

Existen dos razones por las que estos parámetros están obsoletos:

1. Aumenta el tamaño del buncle de cada operador
2. En algunos escenarios los valores tenían que retenerse en memoria, causando presión de memoria general

## Operadores afectados por este cambio

* concatMap
* concatMapTo
* exhaustMap
* mergeMap
* mergeMapTo
* switchMap
* swithMapTo

## Cómo refactorizar

En lugar de utilizar el argumento resultSelector, se puede aprovechar el operador map en el Observable interno:

```
import { fromEvent, switchMap, interval, map } from 'rxjs';

// Obsoleto
fromEvent(document, 'click').pipe(
switchMap((x) => interval(1000), (\_, x) => x + 1)
);

// Sugerencia de refactorización
fromEvent(document, 'click').pipe(
switchMap((x) => interval(1000).pipe(map((x) => x + 1)))
);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.rxjs.es/guias/breaking-changes/resultselector-arguments.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
