# dematerialize

<details>

<summary>Signatura</summary>

#### Firma

`dematerialize<T>(): OperatorFunction<Notification<T>, T>`

#### Parámetros

No recibe ningún parámetro.

#### Retorna

`OperatorFunction<Notification<T>, T>`: Un Observable que emite elementos y notificaciones embebidos en objetos `Notification` emitidos por el Observable fuente.

</details>

## Description

Transforma los objetos `Notification` en emisiones `next`, `error` y `complete`. Es el operador opuesto a `materialize`.

![Diagrama de canicas del operador dematerialize](https://github.com/puntotech/rxjs-docu/blob/master/doc/operators/utility/assets/images/marble-diagrams/utility/dematerialize.png)

`dematerialize` opera un Observable que únicamente emite objetos `Notification` como emisiones `next`, y no emite ningún error. Tal Observable es el resultado de una operación con `materialize`. Esas notificaciones se transforman mediante los metadatos que contienen, y se emiten como notificaciones `next`, `error` y `complete` en el Observable salida.

Se utiliza junto al operador `materialize`.

## Ejemplos

**Convierte las Notificaciones en emisiones con el mismo valor y tipo (error, next o complete)**

[StackBlitz](https://stackblitz.com/edit/rxjs-dematerialize-1?file=index.ts)

```javascript
import { dematerialize } from "rxjs/operators";
import { of, Notification } from "rxjs";

const notification$ = of(
  Notification.createNext("RxJS mola"),
  Notification.createError(new Error("¡Oh no!"))
);

// Emitirá objetos Notification
notification$.subscribe(console.log);
/* Salida: 
Notification { kind: 'N', value: 'RxJS is cool', error: undefined, ... }, 
Notification { kind: 'E', value: undefined, error: {...}, ...}
*/

// Al usar dematerialize, emitirá el valor de la notificación
notification$.pipe(dematerialize()).subscribe(console.log, console.error);
// Salida: RxJS is cool, (error) Oh noez!
```

### Ejemplo de la documentación oficial

**Convierte un Observable de Notificaciones en un Observable de valores**

```javascript
import { of, Notification } from "rxjs";
import { dematerialize } from "rxjs/operators";

const notifA = new Notification("N", "A");
const notifB = new Notification("N", "B");
const notifE = new Notification(
  "E",
  undefined,
  new TypeError("x.toUpperCase is not a function")
);
const materialized = of(notifA, notifB, notifE);
const upperCase = materialized.pipe(dematerialize());
upperCase.subscribe(
  (x) => console.log(x),
  (e) => console.error(e)
);

// Salida:
// A
// B
// TypeError: x.toUpperCase is not a function
```

### Recursos adicionales

[![Source code](https://github.com/puntotech/rxjs-docu/blob/master/doc/operators/utility/assets/icons/source-code.png)](https://github.com/ReactiveX/rxjs/blob/master/src/internal/operators/dematerialize.ts)

[Documentación oficial en inglés](https://rxjs.dev/api/operators/dematerialize)


---

# 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/operadores/utility/dematerialize.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.
