You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Include runtime types in the output of `wrangler types` by default
6
+
7
+
`wrangler types` will now produce one file that contains both `Env` types and runtime types based on your compatibility date and flags. This is located at `worker-configuration.d.ts` by default.
8
+
9
+
This behaviour was previously gated behind `--experimental-include-runtime`. That flag is no longer necessary and has been removed. It has been replaced by `--include-runtime` and `--include-env`, both of which are set to `true` by default. If you were previously using `--x-include-runtime`, you can drop that flag and remove the separate `runtime.d.ts` file.
10
+
11
+
If you were previously using `@cloudflare/workers-types` we recommend you run uninstall (e.g. `npm uninstall @cloudflare/workers-types`) and run `wrangler types` instead. Note that `@cloudflare/workers-types` will continue to be published.
feat: prompt users to rerun `wrangler types` during `wrangler dev`
6
+
7
+
If a generated types file is found at the default output location of `wrangler types` (`worker-configuration.d.ts`), remind users to rerun `wrangler types` if it looks like they're out of date.
`📣 Since you have Node.js compatibility mode enabled, you should consider adding Node.js for TypeScript by running "npm i --save-dev @types/[email protected]". Please see the docs for more details: https://developers.cloudflare.com/workers/languages/typescript/#transitive-loading-of-typesnode-overrides-cloudflareworkers-types`
56
+
"✨ Types written to worker-configuration.d.ts"
60
57
);
61
-
expect(output.stdout).toContain(
62
-
`Remember to run 'wrangler types --x-include-runtime' again if you change 'compatibility_date' or 'compatibility_flags' in your wrangler.toml file.`
`📣 Since you have Node.js compatibility mode enabled, you should consider adding Node.js for TypeScript by running "npm i --save-dev @types/[email protected]". Please see the docs for more details: https://developers.cloudflare.com/workers/languages/typescript/#transitive-loading-of-typesnode-overrides-cloudflareworkers-types`
131
-
);
148
+
awaithelper.run(`wrangler types`);
149
+
150
+
constfile2=readFileSync(typesPath,"utf8");
151
+
152
+
// regenerates env types
153
+
expect(file2).toContain("interface Env {");
154
+
// uses cached runtime types
155
+
expect(file2).toContain("// Begin runtime types");
156
+
expect(file2).toContain("FAKE RUNTIME");
132
157
});
133
158
134
-
it("should not error with nodejs_compat flags",async()=>{
159
+
it("should prompt you to update types if they've been changed",async()=>{
0 commit comments