Replies: 3 comments
-
Just making sure I'm understanding usage correctly. Does this all make sense to you, and can you confirm this is the most recommended path for generated types + experimental generated runtime types + Vitest?
|
Beta Was this translation helpful? Give feedback.
-
Consider pulling in #5086 as part of this work? |
Beta Was this translation helpful? Give feedback.
-
I am using this method to generate the worker-types instead of the npm package of the same name and it has worked fine for me for the most part. My linter has a quandary with some imports though. They are the abstract classes such as WorkerEntrypoint. They are under a "declare module {}", of name "cloudflare:workers". I need a non-type import of them, but from a d.ts. Is that even the correct use of a d.ts file? Bun as a runtime just fails to run any of my workers that have this very common import. tslint-eslint only recognizes the:
Omitting type makes both it and Bun complaint about missing package "cloudflare:workers". I am curious how Wrangler is building this typescript when its a non type import? Which npm package is the actual definition of WorkerEntrypoint coming from? |
Beta Was this translation helpful? Give feedback.
-
Hey everyone 👋 Yesterday we released a new experimental command that dynamically generates runtime types for your project, replacing the need for the
@cloudflare/workers-types
package. It is available as ofwrangler 3.66.0
.What is the command?
What does it do?
compatibility_date
andcompatibility_flags
entries of yourwrangler.toml
.@cloudflare/workers-types
.What is the plan?
This is the first step in attempting to remove any pain points in using TypeScript with workers. This manual command could eventually be used as part of an automated system that doesn't require user intervention.
It would therefore be extremely useful to learn about how you use this command, and any ideas you have for automating the process.
The initial docs are available at https://aj-runtime-types.cloudflare-docs-7ou.pages.dev/workers/languages/typescript/#dynamic-runtime-types-experimental
Beta Was this translation helpful? Give feedback.
All reactions