UNPKG

562 BTypeScriptView Raw
1import type { Maybe } from "./null.js";
2/**
3 * Generic interface for collections implementing
4 * stack functionality.
5 *
6 * @param V - value type
7 * @param P - return type for pop()
8 * @param S - return type for push()
9 */
10export interface IStack<V, P, S> {
11 /**
12 * Returns top-of-stack item.
13 */
14 peek(): Maybe<V>;
15 /**
16 * Removes top-of-stack item and returns type P.
17 */
18 pop(): Maybe<P>;
19 /**
20 * Pushes item onto stack, returns type S.
21 *
22 * @param x
23 */
24 push(x: V): S;
25}
26//# sourceMappingURL=stack.d.ts.map
\No newline at end of file