Skip to content

Add props to ExecutionContext for Hono/CF compatibility #2

@max-lt

Description

@max-lt

Problem

When using Hono with OpenWorkers, there's a type error because Hono's ExecutionContext expects a props property that OpenWorkers' type doesn't have:

error TS2345: Argument of type 'ExecutionContext' is not assignable to parameter of type 'ExecutionContext'.
  Property 'props' is missing in type 'ExecutionContext' but required in type 'ExecutionContext'.

Current workaround

ctx: ExecutionContext & { props: never }

Proposed fix

Add props to ExecutionContext in types/workers.d.ts:

interface ExecutionContext {
  waitUntil(promise: Promise<unknown>): void;
  passThroughOnException(): void;
  props: unknown;  // For Hono/Cloudflare Workers compatibility
}

This would make OpenWorkers types a drop-in replacement for CF Workers types when using Hono.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions