Skip to content

Conversation

flakey5
Copy link
Member

@flakey5 flakey5 commented Aug 7, 2025

Closes #394

@flakey5 flakey5 requested a review from a team as a code owner August 7, 2025 03:36
Copy link
Member

Choose a reason for hiding this comment

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

Should this file be on gitignore maybe? Since it is automatically generated? cc @flakey5

Copy link
Member Author

Choose a reason for hiding this comment

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

Standard practice is to have it be checked in, we can have it ignored but means that we'd need to run the generate command on each ci run + contributors run it on a fresh clone

Copy link
Member

Choose a reason for hiding this comment

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

But aren't these generated anyways automatically? It just doesn't make sense for us to host autogen code. It's like node_modules.

Copy link
Member Author

Choose a reason for hiding this comment

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

But aren't these generated anyways automatically?

Not unless you're talking about the workers-types package that we're using already?

Copy link
Member

Choose a reason for hiding this comment

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

Im under the assumption the types get generated once the build command or something like that runs?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's not the case, we're currently getting our types from the @cloudflare/workers-types package

"@cloudflare/workers-types": "^4.20250722.0",

With this pr we'd be generating them similar to how we precompile the directory listing template where we have it checked in and update it only when it needs to be

Copy link
Member

Choose a reason for hiding this comment

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

It's just that it is a massive type file and it clobs PR reviewing... How and when does this file get updated?

Copy link
Member

Choose a reason for hiding this comment

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

I'm just a bit confused of what's the process of updating this file and how it gets updated.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updating the file is done manually via npm run build:wranger-types, this is only done when it needs to be (i.e. we change our compatability_date or a new api gets released that we wanna use). The npm command just runs wrangler types --include-env=false, which just makes wrangler write the latest workers types into the .d.ts file

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.

Wrangler Type Generation
2 participants