-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
49 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,12 @@ | ||
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; | ||
type Channel<V, K> = { | ||
assert: (key: K) => void; | ||
has: (key: K) => boolean; | ||
get: (key: K) => V | undefined; | ||
set: (key: K, value: V) => void; | ||
} | ||
} | ||
|
||
declare function getSideChannel(): getSideChannel.Channel; | ||
declare function getSideChannel<V, K>(): getSideChannel.Channel<V, K>; | ||
|
||
export = getSideChannel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
type ListNode<T, K> = { | ||
key: K; | ||
next: ListNode<T, K>; | ||
value: T; | ||
}; | ||
type RootNode<T, K> = { | ||
key: object; | ||
next: null | ListNode<T, K>; | ||
}; | ||
|
||
export function listGetNode<T, K>(list: RootNode<T, K>, key: ListNode<T, K>['key']): ListNode<T, K> | void; | ||
export function listGet<T, K>(objects: RootNode<T, K>, key: ListNode<T, K>['key']): T | void; | ||
export function listSet<T, K>(objects: RootNode<T, K>, key: ListNode<T, K>['key'], value: T): void; | ||
export function listHas<T, K>(objects: RootNode<T, K>, key: ListNode<T, K>['key']): boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters