#6905 `wrangler types` + DurableObjects + build process + typescript
Valid bug: wrangler types generates imports from compiled JS (config.main) which has no types. Maintainers approved `--entry` flag solution Oct/Nov 2024, no implementation yet.
Keep open; invite PR from original reporter or add help wanted label
Analysis Report
Issue Review: cloudflare/workers-sdk#6905
Summary
wrangler types generates DurableObjectNamespace<import("./build/index").ClassName> which resolves to any because the compiled JS has no types; user needs ability to specify TypeScript source entrypoint.
Findings
- Created: 2024-10-07
- Updated: 2025-10-30
- Version: 3.80.0 → 4.60.0 (current)
- Component: wrangler (type-generation)
- Labels: bug
- Comments: 4
Key Evidence
- Issue is a valid feature request/bug: when using a build process (e.g., Remix),
wrangler.toml'smainpoints to compiled JS (./build/index), not TS source - The generated types use
import("./build/index").ClassNamewhich has no type information - Maintainer @threepointone suggested adding
--entryflag towrangler types(Oct 2024) - Reporter offered to submit a PR
- Maintainer @penalosa confirmed PRs welcome (Nov 2024)
- No PR has been submitted or merged to address this
- Current
wrangler types(v4.60.0) does NOT have an--entryflag - verified viawrangler types --help - Code analysis confirms the issue:
packages/wrangler/src/type-generation/index.tsusesconfig.mainfor DurableObject imports without considering that it may be compiled JS
Workaround
Reporter documents a valid workaround:
wrangler types --env-namespace EnvBeforeFixup
Then manually override in env.d.ts:
interface Env extends EnvBeforeFixup {
DO: DurableObjectNamespace<import("./app/do").DrizzleTestDO>;
}
Recommendation
Status: KEEP OPEN
Reasoning: This is a valid bug/feature request that has been acknowledged by maintainers. The proposed solution (adding --entry flag to wrangler types) is clear and was endorsed by two maintainers. No fix has been implemented yet despite over a year passing. The issue affects users with build processes (Remix, Vite, etc.) who use DurableObjects.
Action: Keep open and consider prioritizing implementation. The reporter offered to submit a PR over a year ago - may be worth reaching out to see if they're still interested, or adding a "help wanted" or "good first issue" label to attract contributors.
Suggested Comment
Hi! This issue is still valid - the
--entryflag has not been implemented yet. Just checking in: @zwily are you still interested in submitting a PR for this feature? If not, we can add a "help wanted" label to attract other contributors. The implementation would involve:
- Adding an
--entryCLI option towrangler types- Using that path instead of
config.mainwhen generating import statements for DurableObject classesThe relevant code is in
packages/wrangler/src/type-generation/index.ts.
Notes & Feedback (0)
No notes yet.