cloudflare-typescript-workers icon indicating copy to clipboard operation
cloudflare-typescript-workers copied to clipboard

Synchronising with the official typings

Open SerCeMan opened this issue 5 years ago • 3 comments

Hey, folks!

Given that Cloudflare seems to actively support typings for workers now: https://github.com/cloudflare/workers-types, do you have any plans on syncing/migrating to the "official" typings?

Thanks for amazing work here btw :)

SerCeMan avatar Mar 03 '20 07:03 SerCeMan

Thanks!

I made this repository public after Udacity's and Cloudflare's Legal team approvals, then the Cloudflare version was open sourced the following month. I emailed the maintainer and offered to transfer this project to Cloudflare's Github org to replace their version, since it would be far easier to maintain with inside knowledge. We started a discussion, but both of got distracted. @jrf0110 We should follow up! Can/should we defragment?

Do you have any plans on syncing/migrating to the "official" typings?

I'm probably missing new features again. Looks like https://developers.cloudflare.com/workers/reference/apis/html-rewriter/ is the primary. Please PR or I'll handle it at some point.

Both projects are missing parts of the entire spec. I wish Cloudflare would publish an official Worker spec as a strict TypeScript repo, so I wouldn't have to maintain this project at all. :laughing: The Cloudflare version is missing important features, mostly in testing support, used by my internal users/projects. I'll migrate and sunset this when the change is an upgrade.

13rac1 avatar Mar 03 '20 20:03 13rac1

Came across this repo while searching around for something else. Since this is still open, I figured it might be worth updating the state of things that have changed since the last discussion. The official workers-types repo now generates the bindings directly from the internal codebase. Usually where they don't match the intended spec is because we don't yet have that part of the spec implemented: https://blog.cloudflare.com/automatically-generated-types/

miniflare is the official testing strategy and supports all the asks I think (KV, DO, etc). The way I like to think about it is that the test code runs under the Node environment and interacts with your code under test via Miniflare which runs it in the Cloudflare environment.

vlovich avatar Dec 11 '21 17:12 vlovich

Perfect! Generated types is what I wished for in the first place 😀

13rac1 avatar Dec 17 '21 22:12 13rac1