# Sink.mapError

Maps the error channel of a sink using the provided function.
Failures are mapped via `Cause.map`; defects and interrupts are preserved.

## Signatures

```ts
export declare function mapError<A, E, E2, R>(sink: Sink<A, E2, R>, f: (e: E) => E2): Sink<A, E, R>;
```

## Why

A producer's typed error can be translated into the vocabulary expected by an existing consumer
without losing Cause structure.

## Ownership and lifetime

Mapping is synchronous and resource-free. Success order is unchanged; only `Fail` reasons are
mapped, while defects and interruption reasons pass through untouched.

## Examples

```ts
import { Effect } from "effect"
import * as Sink from "@typed/fx/Sink"
const target: Sink.Sink<number, string> = Sink.make(Effect.logError, Effect.log)
const acceptsNumbers = Sink.mapError(target, (error: number) => `code:${error}`)
```
