🐛 BUG: wrangler types
+ DurableObjects + a build process + typescript
#6905
Labels
bug
Something that isn't working
Which Cloudflare product(s) does this pertain to?
Wrangler
What version(s) of the tool(s) are you using?
3.80.0 [wrangler]
What version of Node are you using?
20
What operating system and version are you using?
Mac Sequoia
Describe the Bug
I have a remix app using wrangler+static assets, and am also using a DurableObject. I have the DurableObject defined in my
wrangler.toml
, and then runwrangler types
to generateworker-configuration.d.ts
. That ends up looking something like this:That's great, except,
Env["DO"]
actually is typed asDurableObjectNamespace<any>
becauseimport("./build/index")
is reading from my built javascript file and has no types. If I manually change that toimport("./server.ts").DrizzleTestDO
then typing works fine, but the change would be erased the next time I runwrangler types
.Expected behavior
I'm not sure what the right thing to do here is. As a workaround, I am running
wrangler types --env-namespace EnvBeforeFixup
, and then in myenv.d.ts
overriding with the appropriate type:This lets me have the correct type and not worry about overwriting it when I run
npm run typegen
in the future.Example repo here: https://github.com/zwily/test-drizzle-durable-objects
Steps to reproduce
Please provide the following:
wrangler.toml
A git repo we can clone and run a test suite on, or which has a README with step-by-step instructions, is even better. In this case, please use the field below to provide a link to the minimal repro.
Please provide a link to a minimal reproduction
https://github.com/zwily/test-drizzle-durable-objects
Please provide any relevant error logs
No response
The text was updated successfully, but these errors were encountered: