# selection.StringFilterFields

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

```ts
type StringFilterFields<Value = never, Raw extends string = string> = {
  readonly contains?: string;
  readonly endsWith?: string;
  readonly equals?: Value | Raw | null;
  readonly in?: readonly (Value | Raw)[];
  readonly mode?: "insensitive";
  readonly notIn?: readonly (Value | Raw)[];
  readonly regex?: RegexCriteriaData;
  readonly startsWith?: string;
}
```

A field's criteria accept its decoded shape as well as the text tmux sends: [`where`](/en/ts/latest/reference/selection-selection-where/)`({ active: true })` and [`where`](/en/ts/latest/reference/selection-selection-where/)`({ active: "1" })` are the same query, and serialize identically. A [`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/null) criterion matches any wire value that the field decoder treats as absent or invalid, rather than one particular wire spelling.

The text side exists because the wire does. `encodeFormatValue` lowers every
criterion to tmux's text before a query is serialized, and
[`WhereDocumentV1`](/en/ts/latest/reference/selection-wheredocumentv1/) types both what a caller writes and what
[`decodeWhereDocument`](/en/ts/latest/reference/selection-decodewheredocument/) gives back — so a type that refused text would be
lying about the documents this library's own encoder produces. That is the
difference from an ORM, whose query AST never round-trips through a type the
caller also authors.

[`Raw`](/en/ts/latest/reference/selection-stringfilterfields/#selection.StringFilterFields.type-parameter.Raw) is therefore not a taste. `"0" | "1"` is the exact wire domain for a
flag, while an integer uses `${`[`bigint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt)`}` intersected with a decimal prefix.
That rules out fractions, exponents, radix prefixes, leading zeroes, `-0`,
[`NaN`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN), and prose. TypeScript cannot bound an integer's magnitude, so the
query validator also requires safe range at runtime. `format_values.test.ts`
holds the layers in step.

The substring operations stay [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) deliberately: `contains` asks about
the characters tmux sent, and a numeric field's text has characters like any
other.

## Type parameters

- `Value` (default `never`)
- `Raw` (bound `string`, default `string`)
