Comments (10)
Any chance these name changes could be reverted? They make it difficult for packages targeting both cloudflare workers and service workers.
from workers-types.
I'd say focus 100% on making standards work so that there is a clean API that end-users of this library can most easily port over other existing standard code. This open issue is a substantial regression.
from workers-types.
RequestInit -> RequestInitializerDict
from workers-types.
BodyInit -> BodyInitializer
from workers-types.
Thanks for calling these out. At the very least, I think it would make sense to provide some type
aliases that we mark as @deprecated
, and point to the new names.
from workers-types.
Why rename them? They are a worker standard.
Plus, RequestInitializerDict
is awful... sounds like a python programmer, or something.
from workers-types.
Hey! 👋 I agree these types shouldn't be renamed as they are standard. There's an internal reason why they're different though. In the runtime source code these types are generated from, RequestInitializerDict
is the name of the standard RequestInit
interface, whereas RequestInit
is actually defined as a type alias to RequestInitializerDict | Request
. This get's inlined here:
Line 705 in 51162f8
It's the same for ResponseInit
, BodyInit
and HeadersInit
as far as I remember. Obviously this isn't ideal. We should either rename the types in the runtime, or add an additional renaming phase to the end of the auto-generation script that fixes these kind of issues.
from workers-types.
In the latest version we still leak the non-standard names unfortunately. However, as a mitigation I've reintroduced the standard names as aliases to ease porting issues hopefully (#120). Unfortunately it would be annoying to try to figure out how to get rid of those internal names with our automated type generation vs just fixing the name in the runtime.
If you're still having problems, please reopen or file a new issue. Sorry for the churn this may have caused.
from workers-types.
It would be nice if there were unit tests or at least a sample project that depends on the "standard" values so that this doesn't become an issue again.
from workers-types.
That's a good idea and an area for constant improvement. I'm on the runtime team and was just updating some of the automation pieces and my background is primarily C++/python. I personally unfortunately don't have time/experience to add tests for some of these issues but I'd be happy to review such contributions.
from workers-types.
Related Issues (20)
- Missing properties on IncomingRequestCfPropertiesBotManagement HOT 1
- Incorrect D1 types HOT 2
- RequestInit is missing some properties like 'cache' HOT 3
- Generate types from `workerd` RTTI HOT 1
- RFC: Exportable types HOT 7
- Fix `request.cf` types
- Generate exportable version of `workers-types` HOT 1
- add JSDocs documentation in types
- Move overrides to `workerd` C++ source code HOT 1
- Include C++ parameter names in types generated from JSG RTTI HOT 2
- Get type hints on incoming Request object HOT 4
- IncomingRequestCfPropertiesGeographicInformation makes geo property access an error (regression from 3.17.0) HOT 7
- HtmlRewriter ElementHandler methods can only accept strings (not general Content) HOT 1
- (3.18.0) IncomingRequestCfPropertiesGeographicInformation is the wrong type HOT 2
- Class 'Request<ParamKeyType, Data>' incorrectly extends base class 'Body' HOT 1
- `new Request` bad type HOT 8
- addEventListener has a broken type definition HOT 1
- NPM Release @cloudflare/worker-types 4.20221111.0 HOT 2
- Add Symbol.iterator to WebScoketPair HOT 1
- What is Fetcher for? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from workers-types.