From ab2b5ef4e93fc95a86768d6a0c2d423370d66f0d Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Tue, 15 Sep 2026 18:12:36 +0200 Subject: [PATCH] fix: keep the task() doc attached to task() --- typescript-client/client.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/typescript-client/client.ts b/typescript-client/client.ts index c983e503e0..153ae55295 100644 --- a/typescript-client/client.ts +++ b/typescript-client/client.ts @@ -2284,6 +2284,18 @@ export async function step( return jsonRoundTrip(await fn()); } +// A stable identity for a task's code, what its cached result is keyed on: a +// name is shared by any two tasks called the same, and a step key by any two +// tasks called at the same position, so neither can tell them apart. +function fnFingerprint(fn: Function): string { + const src = fn.toString(); + let h = 0xcbf29ce484222325n; + for (let i = 0; i < src.length; i++) { + h = ((h ^ BigInt(src.charCodeAt(i))) * 0x100000001b3n) & 0xffffffffffffffffn; + } + return h.toString(16); +} + /** * Wrap an async function as a workflow task. * @@ -2300,18 +2312,6 @@ export async function step( * decoded back before the caller sees it: a `Date` comes back as a string, a * `Map` as `{}`. {@link JsonifiedFn} is that shape. */ -/** A stable identity for a task's code, what its cached result is keyed on: a - * name is shared by any two tasks called the same, and a step key by any two - * tasks called at the same position, so neither can tell them apart. */ -function fnFingerprint(fn: Function): string { - const src = fn.toString(); - let h = 0xcbf29ce484222325n; - for (let i = 0; i < src.length; i++) { - h = ((h ^ BigInt(src.charCodeAt(i))) * 0x100000001b3n) & 0xffffffffffffffffn; - } - return h.toString(16); -} - export function task Promise>( fnOrPath: T | string, maybeFnOrOptions?: T | TaskOptions,