Skip to content

wrangler 4.143.0: published cli.d.ts imports modules that are not dependencies, so skipLibCheck: false fails #15940

Description

@MAIAppraiser

What versions & operating system are you using?

  • wrangler@4.143.0 (which depends on miniflare@5.20260926.0-alpha)
  • @cloudflare/workers-types@5.20260929.1, installed because it is wrangler's optional peer dependency
  • @types/node@26.4.1
  • typescript@7.0.2; also reproduced with typescript@5.9.3
  • Node 22.23.1, npm 11.12.1, macOS arm64

Minimal reproduction

package.json:

{
  "name": "repro-wrangler-types",
  "private": true,
  "type": "module",
  "devDependencies": {
    "@cloudflare/workers-types": "^5.20260929.1",
    "@types/node": "26.4.1",
    "typescript": "7.0.2",
    "wrangler": "4.143.0"
  }
}

tsconfig.json:

{
  "compilerOptions": {
    "target": "ES2022",
    "lib": ["ESNext", "DOM", "DOM.Iterable"],
    "module": "ESNext",
    "moduleResolution": "bundler",
    "strict": true,
    "skipLibCheck": false,
    "noEmit": true,
    "types": ["node"]
  },
  "include": ["index.ts"]
}

index.ts:

import type { GetPlatformProxyOptions } from "wrangler";

export const options: GetPlatformProxyOptions = {};

Commands:

npm install
npx tsc -p tsconfig.json

Describe the bug

tsc exits 1 with 20 errors, all in published declaration files: 10 in wrangler/wrangler-dist/cli.d.ts and 10 in miniflare/dist/src/index.d.ts. TypeScript 5.9.3 reports the same 20 errors (exit 2).

wrangler-dist/cli.d.ts, the types entry of the package, imports modules that are neither dependencies nor peer dependencies of wrangler:

wrangler/wrangler-dist/cli.d.ts(1,423): error TS2307: Cannot find module '@cloudflare/workers-utils' or its corresponding type declarations.
wrangler/wrangler-dist/cli.d.ts(10,61): error TS2307: Cannot find module '@cloudflare/containers-shared' or its corresponding type declarations.
wrangler/wrangler-dist/cli.d.ts(13,43): error TS2307: Cannot find module '@cloudflare/workers-shared' or its corresponding type declarations.
wrangler/wrangler-dist/cli.d.ts(14,148): error TS2307: Cannot find module '@cloudflare/remote-bindings' or its corresponding type declarations.
wrangler/wrangler-dist/cli.d.ts(17,111): error TS2307: Cannot find module 'yargs' or its corresponding type declarations.
wrangler/wrangler-dist/cli.d.ts(18,24): error TS2307: Cannot find module 'cloudflare' or its corresponding type declarations.

The same file also imports devtools-protocol and devtools-protocol/types/protocol-mapping, which are not dependencies either.

The miniflare errors are the ones described in #15377 (./shared is missing, and @cloudflare/workers-shared and @cloudflare/config are unresolved). They are still present in miniflare@5.20260926.0-alpha, the version that wrangler@4.143.0 pins, so every consumer of wrangler's types inherits them.

skipLibCheck: true hides all of these errors.

Expected behavior

The types entry of wrangler references only modules that the package ships or declares as dependencies or peer dependencies. Importing a documented type such as GetPlatformProxyOptions then typechecks with skipLibCheck: false.

Why it matters

Libraries that expose wrangler types in their own public declarations pass these errors on to their users. For example, @opennextjs/cloudflare imports GetPlatformProxyOptions in dist/api/cloudflare-context.d.ts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    package:wranglerRelating to the `wrangler` package

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions