workers-types and wrangler types cannot coexist in monorepo without breaking ENV type
I have a main RRv7 application which generates its types with
wrangler types command. However, within the same monorepo I have an astro docs site which uses the astro/cloudflare package, under the hood this still uses the cloudflare/workers-types package. When I install this in my monorepo, all my types for ENV that are coming from wrangler types in the other package are undefined / don't resolve correctly. The namespace appears to be causing a conflict.
Is there any way to handle this when I don't have control over a dependency that is still using the workers-types package?3 Replies
Hi,
You can customize the name of the interface generated by wrangler types with the flag --env-interface <Custom Name>. If the issue is only a namesapce problem, this should fix it.
@olafg This worked, thank you very much, I didn't spot that in the docs. That just solved a massive headache
Happy to hear that you solved it!