# tmux.SparseArray.With

- **Module:** tmux.SparseArray
- **Package:** github.com/libtmux/libtmux-go/tmux
- **Language:** Go
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-go/blob/52968a3181c1c9e6d1b26c565d4b170968ae61c0/tmux/sparse_array.go#L117
- **Page:** https://libtmux.org/en/go/latest/reference/tmux-sparsearray-with/

```
tmux.SparseArray.With(index: int, value: T) -> (SparseArray[T], error)
```

With returns a copy with value inserted or replaced at index. It leaves the receiver unchanged and returns an error matching [ErrInvalidSparseIndex] for a negative index.
