# mapError

Maps typed failures inside the base Cause while preserving defects, interruption, progress, and optimistic history.

## Signatures

```ts
export declare const mapError: {
    <A, E, E2>(f: (e: E) => E2): (data: AsyncData<A, E>) => AsyncData<A, E2>;
    <A, E, E2>(data: AsyncData<A, E>, f: (e: E) => E2): AsyncData<A, E2>;
};
```

## Why

Error adaptation should use Effect Cause semantics instead of flattening the failure channel. Cyclic history throws `TypeError`.

## Ownership and lifetime

This pure transformation acquires no resources and returns new plain wrappers.

## Examples

```ts
import { failure, mapError } from "@typed/async-data"
import { Cause } from "effect"
const state = mapError(failure(Cause.fail(404)), String)
```
