Skip to content

doc(cloudflare): update type generation command #130

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

Merged
merged 1 commit into from
Apr 22, 2025

Conversation

Stradi
Copy link
Contributor

@Stradi Stradi commented Apr 22, 2025

This PR updates following:

  1. We are not using --experimental-include-runtime anymore, since Wrangler now generates runtime types too. When running wrangler types with the flag above, CLI shows an error and stops generating types;
✘ [ERROR] You no longer need to use --experimental-include-runtime.

  `wrangler types` will now generate runtime types in the same file as the Env types.
  You should delete the old runtime types file, and remove it from your tsconfig.json.
  Then rerun `wrangler types`.
  1. Include --env-interface flag. This ensures that getCloudflareContext() returns correct binding types. OpenNext has CloudflareEnv interface but by default Wrangler saves bindings in Env interface. This causes CloudflareEnv (used by OpenNext) not have the correct types for bindings.

Some issues I've found about this:

@Stradi Stradi requested review from james-elicx and a team as code owners April 22, 2025 16:43
Copy link
Collaborator

@james-elicx james-elicx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@james-elicx james-elicx merged commit fbf8c17 into opennextjs:main Apr 22, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Bindings types aren't being populated despite running npx wrangler types
2 participants