// Copyright (c) 2026 Cloudflare, Inc. // Licensed under the Apache 2.0 license found in the LICENSE file or at: // https://opensource.org/licenses/Apache-2.0 // Type definitions for c++ implementation. export interface AsyncResourceOptions { triggerAsyncId?: number; } export class AsyncResource { constructor(type: string, options?: AsyncResourceOptions); runInAsyncScope(fn: (...args: unknown[]) => R, ...args: unknown[]): R; bind unknown>( fn: Func ): Func & { asyncResource: AsyncResource }; static bind< Func extends (this: ThisArg, ...args: unknown[]) => unknown, ThisArg, >( fn: Func, type?: string, thisArg?: ThisArg ): Func & { asyncResource: AsyncResource }; } export class AsyncLocalStorage { run(store: T, fn: (...args: unknown[]) => R, ...args: unknown[]): R; exit(fn: (...args: unknown[]) => R, ...args: unknown[]): R; getStore(): T; }