source: imaps-frontend/node_modules/side-channel/index.d.ts

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 765 bytes
Line 
1declare namespace getSideChannel {
2 type Key = unknown;
3 type ListNode<T> = {
4 key: Key;
5 next: ListNode<T>;
6 value: T;
7 };
8 type RootNode<T> = {
9 key: object;
10 next: null | ListNode<T>;
11 };
12 function listGetNode<T>(list: RootNode<T>, key: ListNode<T>['key']): ListNode<T> | void;
13 function listGet<T>(objects: RootNode<T>, key: ListNode<T>['key']): T | void;
14 function listSet<T>(objects: RootNode<T>, key: ListNode<T>['key'], value: T): void;
15 function listHas<T>(objects: RootNode<T>, key: ListNode<T>['key']): boolean;
16
17 type Channel = {
18 assert: (key: Key) => void;
19 has: (key: Key) => boolean;
20 get: <T>(key: Key) => T;
21 set: <T>(key: Key, value: T) => void;
22 }
23}
24
25declare function getSideChannel(): getSideChannel.Channel;
26
27export = getSideChannel;
Note: See TracBrowser for help on using the repository browser.