import type * as CfTypes from './cf-types.ts' export namespace HelperTypes { type AnyDON = CfTypes.DurableObjectNamespace type DOKeys = { [K in keyof T]-?: T[K] extends AnyDON ? K : never }[keyof T] /** * Helper type to extract DurableObject keys from Env to give consumer type safety. * * @example * ```ts * type PlatformEnv = { * DB: D1Database * ADMIN_TOKEN: string * SYNC_BACKEND_DO: DurableObjectNamespace * } * export default makeWorker({ * syncBackendBinding: 'SYNC_BACKEND_DO', * // ^ (property) syncBackendBinding: "SYNC_BACKEND_DO" * }); */ export type ExtractDurableObjectKeys = DOKeys extends never ? string : DOKeys & string }