# selection.Selection.one

- **Module:** selection.Selection
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/3fe1ca654b81b8cbf4a13b777a001a3298c87a6f/packages/libtmux/src/selection.ts#L472
- **Page:** https://libtmux.org/en/ts/latest/reference/selection-selection-one/

```
selection.Selection.one(criteria: : WhereOf<Model>) -> Model
```

The single member, or the single one matching `criteria`.

Throws `NoMatchError` for none and `MultipleMatchesError` for several, so
"exactly one" is enforced rather than assumed — a `first` that silently
takes the head of two is how the wrong pane gets driven.

An id is not always one member. A window linked into two sessions, or
shared by two grouped sessions, has a placement in each and both carry the
same id, so `one({ id })` raises for a perfectly good id. Add the session
to say which placement is meant.

## Example

```ts
const only = snapshot.sessions.one({ name: "work" });
only.id;
```
