Offload functions to worker threads with shared memory primitives for Node.js.
8
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: add Arg<T> type alias for cleaner tooltips on moroutine parameters

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+5 -1
+1
src/index.ts
··· 1 1 export { mo } from './mo.ts'; 2 + export type { Arg } from './mo.ts'; 2 3 export { Task } from './task.ts'; 3 4 export { workers } from './worker-pool.ts'; 4 5 export { transfer } from './transfer.ts';
+4 -1
src/mo.ts
··· 9 9 * @param fn - The function to offload to a worker thread. 10 10 * @returns A function that creates a {@link Task} when called. 11 11 */ 12 - type TaskableArgs<A extends unknown[]> = { [K in keyof A]: A[K] | Task<A[K]> }; 12 + /** A value or a Task that resolves to that value on the worker. */ 13 + export type Arg<T> = T | Task<T>; 14 + 15 + type TaskableArgs<A extends unknown[]> = { [K in keyof A]: Arg<A[K]> }; 13 16 14 17 export function mo<A extends unknown[], R>( 15 18 importMeta: ImportMeta,