Trying to call registerWorker on a WorkerImplementation that contain an async function returning a transferrable (i.e. {result, transfer}), will give this typing error:
Type '() => Promise<{ result: number; transfer: never[]; }>' is not assignable to type '() => WorkerReturnType<() => Promise<number>>'.
Type 'Promise<{ result: number; transfer: never[]; }>' is not assignable to type 'WorkerReturnType<() => Promise<number>>'.
Type 'Promise<{ result: number; transfer: never[]; }>' is not assignable to type 'Promise<number>'.
Type '{ result: number; transfer: never[]; }' is not assignable to type 'number'.
To Reproduce
This PR can be used to reproduce the error with the actual tests.
Trying to call
registerWorker
on aWorkerImplementation
that contain an async function returning a transferrable (i.e.{result, transfer}
), will give this typing error:To Reproduce This PR can be used to reproduce the error with the actual tests.
Expected behavior No typing error.