index.d.ts 765 B

123456789101112131415161718192021222324252627
  1. declare 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. type Channel = {
  17. assert: (key: Key) => void;
  18. has: (key: Key) => boolean;
  19. get: <T>(key: Key) => T;
  20. set: <T>(key: Key, value: T) => void;
  21. }
  22. }
  23. declare function getSideChannel(): getSideChannel.Channel;
  24. export = getSideChannel;