> For the complete documentation index, see [llms.txt](/llms.txt).
> The full corpus is at [llms-full.txt](/llms-full.txt).

# getSibling

## Call Signature

> **getSibling**\<`TMatch`\>(`snapshot`, `path`, `options`): \{ `node`: `TMatch`; `path`: `Path`; \} \| `undefined`

Defined in: get-sibling.ts:19

Get a sibling of the node at a given path.

Without `match`, returns the immediate next or previous sibling.
With `match`, returns the first sibling in `direction` that satisfies
the predicate.

When `match` is a type predicate, the returned `node` narrows to that type.

### Type Parameters

#### TMatch

`TMatch` *extends* `Node`

### Parameters

#### snapshot

`TraversalSnapshot`

#### path

`Path`

#### options

##### direction

`"next"` \| `"previous"`

##### match

(`node`, `path`) => `node is TMatch`

### Returns

\{ `node`: `TMatch`; `path`: `Path`; \} \| `undefined`

## Call Signature

> **getSibling**(`snapshot`, `path`, `options`): \{ `node`: `Node`; `path`: `Path`; \} \| `undefined`

Defined in: get-sibling.ts:30

### Parameters

#### snapshot

`TraversalSnapshot`

#### path

`Path`

#### options

##### direction

`"next"` \| `"previous"`

##### match?

(`node`, `path`) => `boolean`

### Returns

\{ `node`: `Node`; `path`: `Path`; \} \| `undefined`