# selection.Selection.one

- **Module:** selection.Selection
- **Package:** @libtmux/libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/2cb93308200da38a26b59876618116850f110607/packages/libtmux/src/selection.ts#L466
- **Page:** https://libtmux.org/reference/ts/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;
```
