alors
CDCloudflare Developers
•Created by Web Bae on 7/1/2024 in #workers-help
Service Workers and Typescript
fix: have to define entrypoint in
wrangler.toml
. again: wrangler types
will reset to Fetcher, so be aware
all working deployed 😭 bun link working a dream now. semver.8 replies
CDCloudflare Developers
•Created by Web Bae on 7/1/2024 in #workers-help
Service Workers and Typescript
8 replies
CDCloudflare Developers
•Created by Web Bae on 7/1/2024 in #workers-help
Service Workers and Typescript
helpful rabbit hole
https://discord.com/channels/595317990191398933/779390076219686943/1254019149223563355
good impl. reference
https://github.com/cloudflare/js-rpc-and-entrypoints-demo/tree/0b482ea46e2f69f0b8bf933ec4a65e6f0b1a767f
8 replies
CDCloudflare Developers
•Created by Web Bae on 7/1/2024 in #workers-help
Service Workers and Typescript
8 replies
CDCloudflare Developers
•Created by Web Bae on 7/1/2024 in #workers-help
Service Workers and Typescript
The @cloudflare/workers-types package defines the type Service<MyEntrypointType>, which describes the type of a service binding. MyEntrypointType is the type of your server-side interface. Service<MyEntrypointType> applies all the necessary transformations to turn this into a client-side type, such as converting all methods to async, replacing functions and RpcTargets with (properly-typed) stubs, and so on. It is up to you to share the definition of MyEntrypointType between your server app and its clients. You might do this by defining the interface in a separate shared TypeScript file, or by extracting a .d.ts type declaration file from your server code using tsc --declaration.https://blog.cloudflare.com/javascript-native-rpc#what-about-type-safety seems the approach, combined with the forum post you ref.d @Web Bae as for sharing types between your repos, that's a whole new rabbit hole. monorepos are fun lol
8 replies