woa... ``` npx wrangler --version ⛅️ wrangler 2.21.1 (update available 3.57.0) -------------------
woa...
npx wrangler --version
⛅️ wrangler 2.21.1 (update available 3.57.0)
-------------------------------------------------------
andrew@amackenz-mac collectr % wrangler --version
⛅️ wrangler 3.57.0
-------------------wrangler within a project, then calling it from there, so that you consitently use the same versionnpm doesn't actually support that for arbitrary commands, so npx would probably be the next best thing.pnpm for arbitrary command execution using the locally installed package: pnpm wrangler deploy [whatever]satisfies in your workers?request: Request, env: Envsatisfies ExportedHandler<Env> 
ExportedHandler : Promise<Response> for better DX, and then satisfies ExportedHandler<Env>;queue handlers don't need to return anything so: Promise<void> works wellsatisfies operatore introduced in TypeScript 4.9 shouldn't just check that the function matches expect class?batch is of type MessageBatch?ExportedHandler takes other generic types, included one for MessageBatchsatisfies covers most of the function. But the return type being explicit creates better errors for DX.ExportedHandler<Env, MessageBatch> for examplesatisfies Env in the index.ts even tho now that's automatically generated in worker-configuration.d.tswrangler types tho
fetch as : Promise<Response> so ts will catch if you ever accidentally return something elseResponse | Promise<Response> is implied from implements DurableObjectexport default {
async fetch(request, env, ctx): Promise<Response> {
// do things
},
} satisfies ExportedHandler<Env>;Response | Promise<Response>implements DurableObject# wrangler.toml
# ...
routes = [
{ pattern = "example.test/api*", zone_name = "example.test" },
{ pattern = "localhost:4321/api*", zone_name = "localhost" },
]