Skip to content

@cloudflare/workers-types v5#3741

Open
penalosa wants to merge 8 commits into
mainfrom
penalosa/workers-types-v5
Open

@cloudflare/workers-types v5#3741
penalosa wants to merge 8 commits into
mainfrom
penalosa/workers-types-v5

Conversation

@penalosa
Copy link
Copy Markdown
Contributor

@penalosa penalosa commented Mar 17, 2025

After the stabilisation of wrangler types-based runtime type generation in Wrangler v4, the confusing entrypoint system in @cloudflare/workers-types is no longer needed. As such, this PR changes @cloudflare/workers-types to only include the latest version of the runtime types (previously this was the /experimental entrypoint).

After some analysis of open source repos with Sourcegraph, it's clear that the usage of the alternative entrypoints to @cloudflare/workers-types is very low to 0, and so this shouldn't have a practical impact on users. However, it's still a breaking change, and so this will be released as @cloudflare/workers-types@5. There are two migration paths available to users:

  • Continue using @cloudflare/workers-types, but be aware that the typing environment may not be 100% compatible with runtime behaviour, depending on your compatibility date + flags, or
  • Migrate to wrangler types

cc @anonrig this will also cut the build time of workers-types by 90%

cc @irvinebroque @korinne for visibility

@penalosa penalosa requested review from a team as code owners March 17, 2025 18:54
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 17, 2025

The generated output of @cloudflare/workers-types matches the snapshot in types/generated-snapshot 🎉

@DaniFoldi
Copy link
Copy Markdown
Contributor

Hi @penalosa 👋,

Would it perhaps make more sense to have it defined as an alias to the "latest stable" date? Right now, that would be 2023-07-01, which more closely maps to types available to users. Experimental has some methods which aren't yet accessible to users, but if they show up in types, it might cause confusion.

@penalosa penalosa marked this pull request as draft March 17, 2025 19:02
@penalosa
Copy link
Copy Markdown
Contributor Author

(converting to draft so that this doesn't get accidentally merged while still under discussion)

@penalosa
Copy link
Copy Markdown
Contributor Author

@DaniFoldi The problem with the "latest stable" compatibility date is that it doesn't really represent anything in the runtime. It's just the last time the typings changed in a significant way, but it also means users miss out on types added since then. Using the experimental entrypoint has a slight risk of experimental APIs being available in user code, but it also means that everything else is always up to date.

@irvinebroque
Copy link
Copy Markdown
Collaborator

So basically this means — if you want types that match a specific compat date — then you need to use wrangler types?

Comment thread types/scripts/build-types.ts Outdated
// Latest compatibility date with experimental features
{ compatDate: "experimental" },
];
const ENTRYPOINTS = [{ compatDate: "experimental", name: "" }];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we move the spawning of workerd to bazel now?

@DaniFoldi
Copy link
Copy Markdown
Contributor

but it also means users miss out on types added since then

I don't think it does, the only types that are unavailable are ones that haven't been default on that date, such as some stream related ones in the oldest date.

@penalosa penalosa force-pushed the penalosa/workers-types-v5 branch from 578f6d4 to d4e8785 Compare August 12, 2025 17:02
@penalosa penalosa marked this pull request as ready for review August 12, 2025 17:04
@penalosa penalosa requested a review from a team as a code owner August 12, 2025 17:04
Comment thread types/scripts/build-types.ts
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@NuroDev
Copy link
Copy Markdown
Member

NuroDev commented May 7, 2026

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request May 7, 2026
@NuroDev NuroDev enabled auto-merge May 15, 2026 14:35
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.

7 participants