Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💡 Support Service Workers in wrangler types #1378

Open
zhawtof opened this issue Dec 26, 2024 · 0 comments
Open

💡 Support Service Workers in wrangler types #1378

zhawtof opened this issue Dec 26, 2024 · 0 comments
Labels
Priority: Normal Minor issue impacting one or more users Type: Feature Request A big idea that would be split into smaller pieces

Comments

@zhawtof
Copy link

zhawtof commented Dec 26, 2024

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()
@zhawtof zhawtof added Priority: Normal Minor issue impacting one or more users Type: Feature Request A big idea that would be split into smaller pieces labels Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Normal Minor issue impacting one or more users Type: Feature Request A big idea that would be split into smaller pieces
Projects
None yet
Development

No branches or pull requests

1 participant