Comments (6)
So using the "official" Cloudflare types is blocked on cloudflare/workers-types#199
until they fix how they present things, we're stuck with our own bespoke types. I've been working on some new well-documented types for the module worker syntax for my own use, which is a lot easier to encapsulate things than with the "globals" syntax, but yeah right now it's a bit painful.
from denoflare.
Yea I've been maintaining my own types (in that cloudflare_workers_types.d.ts) from back before the official types file even existed.
Still find it useful as the the official one lags behind (esp for new cf alpha/beta services) and doesn't play nice with Deno.
I would like to have cloudflare_workers_types.d.ts reflect the current cloudflare production runtime as much as possible, so if you know of any specific differences that you are relying on in production, please raise them as issues/PRs on that file. Only thing to keep in mind is that denoflare's fakes/stubs/proxies may need to change along with any core type changes.
from denoflare.
@ylxdzsw The latest release v0.5.10 allows the no-options version of KVNamespace.get
. There are still advantages to maintaining a Deno-friendly and forward-looking version of these types, so our cloudflare_workers_types.d.ts
isn't going anywhere any time soon.
from denoflare.
For anyone following, the @cloudflare/workers-types was updated so that it is now partially importable to avoid the conflicts that used to occur. I haven't tested it with denoflare but it may be easier to use at least a subset of the types now since they dont have to be global and things like "blob" should no longer conflict.
from denoflare.
To follow up, I tested and this works great using unpkg:
import { Request, ExecutionContext } from "https://unpkg.com/@cloudflare/[email protected]/experimental/index.ts"
import * as semVer from "https://deno.land/[email protected]/semver/mod.ts"
export default {
async fetch() {
const res = `Hello World! ${semVer.increment("1.2.3", "patch")}`
console.log(res)
return new Response(res);
},
};
from denoflare.
Nice, I could see migrating over to these piecemeal (re-exporting) in our types file where duplicative, and just keeping our file for the bleeding edge services that are not in workers-types yet.
I gave them some feedback about better jsdocs, and they are working on it. That's another advantage our types still have in some cases.
from denoflare.
Related Issues (20)
- denoflare serve: WorkerD support? HOT 1
- Error running script Error: Bad module.default: undefined HOT 6
- no KV? HOT 1
- importText under windows breaks when using a subdirectory HOT 3
- D1 Bindings do not work as regular bindings until end of Beta HOT 2
- How can I configure triggers? HOT 5
- denoflare push does not consult the ENV or flags for account-id and api-token HOT 5
- Plain .js files not working: Script did not add a fetch listener HOT 1
- Provide TS types for non-standard `fetch` request init `cf` object HOT 1
- Deno.spawn is not a function when deploying / serving any worker HOT 1
- Denoflare using importMaps from deno.json HOT 2
- denoflare push uploads bundle with no registered event handlers HOT 1
- `denoflare serve` in local isolation mode hangs when using importText/Binary/Wasm on Deno v1.34.2 HOT 1
- Error running script SyntaxError: Identifier 'concat' has already been declared at blob:null/fc6d65b1-68e1-4492-9180-8f3271ba2cd7:824:1 HOT 3
- Documentation request: tutorials at the beginner level
- Cannot use Async fetch prototype like Cloudflare allows HOT 3
- durable objects's documentation is missing? HOT 1
- bundle dynamic import (typescript) HOT 2
- add D1 migration support in denoflare cli HOT 9
- Fetch init.signal error HOT 7
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 denoflare.