Skip to content

Commit bfe0f6f

Browse files
chore: include templates directory in wrangler"s check:type script (#8302)
1 parent 2cad136 commit bfe0f6f

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

packages/wrangler/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"build": "pnpm run clean && pnpm run bundle && pnpm run emit-types && pnpm run generate-json-schema",
5555
"bundle": "node -r esbuild-register scripts/bundle.ts",
5656
"check:lint": "eslint . --max-warnings=0",
57-
"check:type": "tsc",
57+
"check:type": "tsc -p ./tsconfig.json && tsc -p ./templates/tsconfig.json",
5858
"clean": "rimraf wrangler-dist miniflare-dist emitted-types",
5959
"dev": "pnpm run clean && concurrently -c black,blue --kill-others-on-fail false \"pnpm run bundle --watch\" \"pnpm run check:type --watch --preserveWatchOutput\"",
6060
"emit-types": "tsc -p tsconfig.emit.json && node -r esbuild-register scripts/emit-types.ts",

packages/wrangler/templates/pages-dev-pipeline.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ export default <ExportedHandler<{ ASSETS: Fetcher }>>{
2020

2121
for (const include of routes.include) {
2222
if (isRoutingRuleMatch(pathname, include)) {
23-
if (worker.fetch === undefined) {
23+
const workerAsHandler = worker as ExportedHandler;
24+
if (workerAsHandler.fetch === undefined) {
2425
throw new TypeError("Entry point missing `fetch` handler");
2526
}
26-
return worker.fetch(request, env, context);
27+
return workerAsHandler.fetch(request, env, context);
2728
}
2829
}
2930

packages/wrangler/templates/tsconfig.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,12 @@
44
"types": ["@cloudflare/workers-types"]
55
},
66
"include": ["**/*.ts"],
7-
"exclude": ["__tests__", "./init-tests/**"]
7+
"exclude": [
8+
"__tests__",
9+
"./init-tests/**",
10+
// Note: `startDevWorker` and `middleware` should also be included but some work is needed
11+
// for that first (see: https://github.com/cloudflare/workers-sdk/issues/8303)
12+
"startDevWorker",
13+
"middleware"
14+
]
815
}

0 commit comments

Comments
 (0)