Skip to content

💡 Support Service Workers in wrangler types #1378

@zhawtof

Description

@zhawtof

Describe the feature you'd like
When using wrangler types --x-include-runtime support generating types for service workers. Today, it only generates a Fetcher, which does not include the typing needed to pull in functions.

Describe alternatives you've considered
The only option I can envision is hard-coding Service<Engine> into the output. If there is a better alternative, I'm all ears.

Additional context

wrangler.toml

services = [
  { service = "engine", binding = "ENGINE", entrypoint = "EngineService" }
]

You will see the following after running wrangler types --x-include-runtime.

worker-configuration.d.ts

interface Env {
	ENGINE: Fetcher;
}

Which means that any function that is referenced is not going to work with typed support

env.ENGINE.anyFunction()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: NormalMinor issue impacting one or more usersType: Feature RequestA big idea that would be split into smaller pieces

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions