# RefArray.last

Gets the last element of a `RefArray` as a `Filtered`.

## Signatures

```ts
export declare const last: <A, E, R>(ref: RefArray<A, E, R>) => RefSubject.Filtered<A, E, R>;
```

## Why

Models the possibly absent result of last as Filtered state, so absence stays explicit while
later source versions can make a value available.

## Ownership and lifetime

The last view retains no independent value. Its Effect read fails with NoSuchElement
while absent; the observing Scope owns and finalizes its Fx subscription.

## Examples

```ts
import { Effect } from "effect"
import * as RefArray from "@typed/fx/RefArray"

const program = Effect.gen(function* () {
  const items = yield* RefArray.make([1, 2, 3, 4, 5])

  const last = RefArray.last(items)
  const value = yield* last
  console.log(value) // 5

  // If array becomes empty, Filtered will fail
  yield* RefArray.set(items, [])
  // yield* last would fail with NoSuchElementError
})
```
