1
0
Fork 0
forked from svrjs/svrjs
This repository has been archived on 2024-11-10. You can view files and clone it, but cannot push or open issues or pull requests.
svrjs/node_modules/side-channel/index.d.ts

28 lines
765 B
TypeScript
Raw Permalink Normal View History

2024-08-26 08:36:01 +02:00
declare namespace getSideChannel {
type Key = unknown;
type ListNode<T> = {
key: Key;
next: ListNode<T>;
value: T;
};
type RootNode<T> = {
key: object;
next: null | ListNode<T>;
};
function listGetNode<T>(list: RootNode<T>, key: ListNode<T>['key']): ListNode<T> | void;
function listGet<T>(objects: RootNode<T>, key: ListNode<T>['key']): T | void;
function listSet<T>(objects: RootNode<T>, key: ListNode<T>['key'], value: T): void;
function listHas<T>(objects: RootNode<T>, key: ListNode<T>['key']): boolean;
type Channel = {
assert: (key: Key) => void;
has: (key: Key) => boolean;
get: <T>(key: Key) => T;
set: <T>(key: Key, value: T) => void;
}
}
declare function getSideChannel(): getSideChannel.Channel;
export = getSideChannel;