@tsdotnet/linked-node-list
Version:
An unprotected bi-directional linked list. Useful for implementing other collections.
29 lines (23 loc) • 563 B
TypeScript
/*!
* @author electricessence / https://github.com/electricessence/
* Licensing: MIT
*/
export interface LinkedNode<TNode extends LinkedNode<TNode>>
{
previous?: TNode;
next?: TNode;
}
export type ProtectedLinkedNode<TNode extends LinkedNode<TNode>> =
Omit<TNode, 'previous' | 'next'>
& {
readonly previous?: ProtectedLinkedNode<TNode>;
readonly next?: ProtectedLinkedNode<TNode>;
};
export interface NodeWithValue<TValue>
{
value: TValue;
}
export interface LinkedNodeWithValue<T>
extends LinkedNode<LinkedNodeWithValue<T>>, NodeWithValue<T>
{
}