alors
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
[[services]]
binding = "OG"
service = "epub-rpc-parser-worker"
entrypoint = "OGWorker"
[[services]]
binding = "OG"
service = "epub-rpc-parser-worker"
entrypoint = "OGWorker"
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
No description
8 replies
CDCloudflare Developers
Created by Web Bae on 7/1/2024 in #workers-help
Service Workers and Typescript
No description
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