19 Replies
@Kiwi there has to be a tsconfig that will tell tsc to link the packages. I tried adding the other d.ts files in include but didnt work either:
Yeah that is effectively what I am already doing
so your method passes tsc?
"types": ["./reset.d.ts", "./worker-configuration.d.ts", "./cloudflare-service-bindings.d.ts", "node"],
Something like that
And for clarity, the interface Env extends CloudflareServiceBindings {}
opens the Env
interface and extends itare you using the new typegen with wrangler 4?
still having trouble with your method. do you mind giving it a quick glance to see if im doing anything dumb?
when I run
tsc --noEmit
I get errors like:
Does your type list include the file which has CloudflareServiceBindings?
yes thats
./extended-env.d.ts
Otherwise looks fine
Maybe
WorkerEntrypoint
takes the generic? WorkerEntrypoint<Env>
?what are you using for monorepo management?
im on turborepo
Oh, CONFIG_STORE isn't CONFIG_SERVICE
I'm not turborepo, but a bun workspaces repo
but same flavour of problem
CONFIG_SERVICE is the worker and CONFIG_STORE is a DO
And that is already defined in
Env
?
Oh I just reminded byself that I do this in my WorkerEntrypoint WorkerEntrypoint<Env & CloudflareServiceBindings>
which should be redundanttried this just now but same issue
when i log my env its still showing
│ db env {
│ ENVIRONMENT: 'dev',
│ SPANNER_DATABASE_ID: 'db-1',
│ DISPATCH_SERVICE: Fetcher {},
│ CONFIG_SERVICE: Fetcher {}
│ }
the fetcher???
so I think my setup is not 100% since I am doing
WorkerEntrypoint<Env & CloudflareServiceBindings>
in places
Env
should already be Env & CloudflareServiceBindings
so there is an obvious setup issue in my repo
But otherwise doing the union does give you the result you are after, but it's more verbose/explicit and should have already been set up by the compiler config types
arrayso just like?
? its still logging both services as Fetcher {} so confused lol
Yes, I think that is right. Your logs are run time right
The Fetcher instance is what is created at runtime, with the RPC stuff done via some proxy indirection, so your RPC methods aren't going to be visible then
at least thats my understanding
ok that makes sense. prob some weird obscure tsconfig I have that your for your time sorry for all the questions lol
one more - do you have a root tsconfig? or is everyrhing package/apps dependent?
I have one per package right now, but I think a root one would be doable
ok same just checking if that might be the difference. btw meant to say thank you for your time haha not 'that your for'