udacity / cloudflare-typescript-workers

Types and mocks for building a tested Typescript Cloudflare Worker, generates three NPM packages
Apache License 2.0
139 stars 12 forks source link

Synchronising with the official typings #19

Open SerCeMan opened 4 years ago

SerCeMan commented 4 years ago

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 :)

13rac1 commented 4 years ago

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.

vlovich commented 2 years ago

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.

13rac1 commented 2 years ago

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