You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my main thread, the wrapped worker will expose foo as Remote<() => string> | Promise<undefined>, this causes two problems:
await fooWorker?.foo(); causes lint error for when foo is Promise<undefined>.
If I resolve the method getter promise before actually calling, comlink proxy will try to .apply() to undefined and throws. Option 1 throws this one too if foo is actually undefined at runtime.
constworker=newWorker("./WrappedWorker.ts");constfooWorker=Comlink.wrap(worker);// 1. Not all constituents of type 'Promise<undefined> | Remote<() => Promisable<void>>' are callable.awaitfooWorker?.foo();// 2. TypeError: Cannot read properties of undefined (reading 'apply')constfooMethod=awaitfooWorker.foo;awaitfooMethod?.();
The text was updated successfully, but these errors were encountered:
I would like to expose a common interface for all my workers like this:
And one of my workers implements it like this:
In my main thread, the wrapped worker will expose
foo
asRemote<() => string> | Promise<undefined>
, this causes two problems:await fooWorker?.foo();
causes lint error for whenfoo
isPromise<undefined>
..apply()
toundefined
and throws. Option 1 throws this one too iffoo
is actually undefined at runtime.The text was updated successfully, but these errors were encountered: