# selection.parseLegacyWhere

- **Module:** selection
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-ts/blob/46cccfef2a546de55ce8b308249b8c76339089a0/packages/libtmux/src/selection.ts#L648
- **Page:** https://libtmux.org/en/ts/latest/reference/selection-parselegacywhere/

```
function parseLegacyWhere<
  Model extends "session" | "window",
>(
  model: Model,
  input: unknown,
): Extract<WhereDocumentV1, { readonly model: Model }>
```

Convert the Python port's `name__contains` spelling to canonical criteria.

Accepts one own data property on a plain object and never invokes accessors
or conversion hooks. The returned document and its criteria are frozen.

## Examples

```ts
import { parseLegacyWhere } from "libtmux/selection";
const document = parseLegacyWhere("window", { name__contains: "log" });
snapshot.windows.where(document.where);
```

## Type parameters

- `Model` (bound `"session" | "window"`)

## Parameters

- `model` (`Model`)
- `input` (`unknown`)

## Raises

- [`QueryValidationError`](/en/ts/latest/reference/errors-queryvalidationerror/): when the model is not `session` or `window`, or the input is not exactly one string-valued `name__contains` property.
