Skip to content

feat(wrangler): Add cron union type generation#12740

Draft
NuroDev wants to merge 11 commits intomainfrom
NuroDev/cron-trigger-literal-types
Draft

feat(wrangler): Add cron union type generation#12740
NuroDev wants to merge 11 commits intomainfrom
NuroDev/cron-trigger-literal-types

Conversation

@NuroDev
Copy link
Copy Markdown
Member

@NuroDev NuroDev commented Mar 3, 2026

Fixes N/A.

Changes

  • Updates Wrangler's type generation logic to allow for adding a new Cloudflare.GlobalProps.crons property
    • Only generated if cron triggers are defined in the users Wrangler config
    • If the cron triggers array is defined but empty, we default to string
    • Otherwise we create a union string of all cron patterns.

This allows the user to get a more accurate typing of what to expect in their scheduled handler.

Example

declare namespace Cloudflare {
	interface GlobalProps {
		crons: "0 * * * *" | "*/5 * * * *";
	}
	interface Env {
	}
}

  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s): WIP
    • Documentation not necessary because:

A picture of a cute animal (not mandatory, but encouraged)

@NuroDev NuroDev self-assigned this Mar 3, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 3, 2026

⚠️ No Changeset found

Latest commit: b1edf5d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 3, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@12740

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@12740

miniflare

npm i https://pkg.pr.new/miniflare@12740

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@12740

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@12740

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@12740

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@12740

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@12740

wrangler

npm i https://pkg.pr.new/wrangler@12740

commit: e2875d5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

2 participants