Item type; must exclude undefined. null is allowed.
Retrieves the item at the given index.
Supports negative indices (-1 = tail). Non-integers are truncated toward zero.
Position in the deque.
The item, or null if out of range.
Appends items to the tail.
Items to append (in order).
The new length.
Inserts items at the head.
Items to insert; first argument becomes the new head.
The new length.
A double-ended queue with amortized O(1) insertion and removal at both ends.
Uses a sparse index map so head and tail grow independently without array shifts.
Remarks
The item-type constraint is enforced by TypeScript, not runtime checks. Because missing items also return
null, uselengthto distinguish a stored null item from an empty deque.Example