Skip to content

Commit 66c0bf2

Browse files
committed
Clarify type round-trip types
1 parent 675907b commit 66c0bf2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/type-checks.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,16 @@ async function closureSoICanUseAwait() {
203203
//
204204

205205
// Type round trips
206+
// This tests that Local is the exact inverse of Remote for objects:
206207
assert<
207208
IsExact<
208209
Comlink.Local<Comlink.Remote<Comlink.ProxyMarked>>,
209210
Comlink.ProxyMarked
210211
>
211212
>(true);
213+
// This tests that Local is the exact inverse of Remote for functions, with one difference:
214+
// The local version of a remote function can be either implemented as a sync or async function,
215+
// because Remote<T> always makes the function async.
212216
assert<
213217
IsExact<
214218
Comlink.Local<Comlink.Remote<(a: number) => string>>,

0 commit comments

Comments
 (0)