# selection.Selection.exists

- **Module:** selection
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/073b9d7dedad900bff6f5ec0ea47794e40225870/packages/libtmux/src/selection.ts#L567
- **Page:** https://libtmux.org/en/ts/latest/reference/selection-selection-exists/

```
exists(criteria?: WhereOf<Model>): boolean
```

Whether anything matches. Cheaper to read than comparing a count to zero.

## Examples

```ts
if (snapshot.windows.exists({ name: "build" })) {
  await session.selectWindow("build");
}
```

## Type parameters

- [`Model`](/en/ts/latest/reference/selection-selection/#selection.Selection.type-parameter.Model), declared by [`Selection<Model>`](/en/ts/latest/reference/selection-selection/)

## Parameters

- `criteria?` (`WhereOf<Model>`)

## Guides

Pages that discuss `exists`.

- [Filtering and queries](/en/ts/latest/concepts/queries/)
