cloudflare / cloudflare/workers-sdk

Wrangler's `check:type` script should fully include the `templates` directory

Open
#8,303 0 comments 0 reactions 0 assignees View on GitHub
maintenance
Dominant language
TypeScript
Stars
4.5k
Forks
1.5k
Avg merge
3d 8h
Merged PRs (30d)
187

Description

Currently wrangler's `check:type` script is not including at all the `templates` directory, that is being addressed in https://github.com/cloudflare/workers-sdk/pull/8302 (hopefully the PR will lend soon and I'll accordingly update this issue)

However in the PR two sub directories of `templates` are being excluded `startDevWorker` and `middleware`, I've attempted to also include those in the type checking but that turned out to be quite problematic because the files inside `templates` are type checked in a worker context but some of their files (inside `startDevWorker` and `middleware`) import files from the wrangler `src` directory where the context is that of nodejs, causing lots of type errors.

There are a good number of type errors currently and there seem to be quite a bunch to untangle, since this is not blocking anyone I thought it would not be worth it for me to spend too much time on this right now, so I'm just excluding such directories in the type checking and hopefully me or someone else can pick this back up when they have extra cycles to spare.

Contributor guide

Open the contributing guide

Research direction

Start with Wrangler's `check:type` script and the exclusions for `templates/startDevWorker` and `templates/middleware`. Read the imported files in those directories and the corresponding files under Wrangler's `src` to identify the worker-versus-Node.js type conflicts. Done means both directories are included in type checking without unresolved type errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.