Skip to content

Remove unused dependencies and declare missing ones - #3600

Open
SuperDJ wants to merge 3 commits into
GoogleChrome:v7from
SuperDJ:chore/remove-unused-dependencies
Open

SuperDJ wants to merge 3 commits into
GoogleChrome:v7from
SuperDJ:chore/remove-unused-dependencies

Conversation

@SuperDJ

@SuperDJ SuperDJ commented Nov 6, 2026

Copy link
Copy Markdown

Remove packages that nothing uses:

  • Root: @babel/cli, @rollup/plugin-typescript, coveralls, bytes, gzip-size and @types/eslint.
  • workbox-build: @babel/runtime, which isn't imported, as bundling uses babelHelpers: 'bundled'. Also drop its dependency-check ignore entries.
  • infra/pr-bot/aggregate-size-plugin.js, which nothing loads and which imports the undeclared pr-bot. It was the only user of bytes and gzip-size.

Declare packages that were used but missing:

  • type-fest moves from the root to workbox-build, whose published types import it.
  • body-parser is added to the 13 demo manifests that require it.

workbox-build was compiling against type-fest 0.16.0, hoisted from tempy, rather than the 3.13.1 declared at the root. Using 3.13.1 fails with TS2411 on the WorkboxPackageJSON interface, so it is now a type alias with the same shape.

Created with Claude,

@google-cla

google-cla Bot commented Nov 6, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Remove packages that nothing uses:
- Root: @babel/cli, @rollup/plugin-typescript, coveralls, bytes, gzip-size
  and @types/eslint.
- workbox-build: @babel/runtime, which isn't imported, as bundling uses
  babelHelpers: 'bundled'. Also drop its dependency-check ignore entries.
- infra/pr-bot/aggregate-size-plugin.js, which nothing loads and which
  imports the undeclared pr-bot. It was the only user of bytes and gzip-size.

Declare packages that were used but missing:
- type-fest moves from the root to workbox-build, whose published types
  import it.
- body-parser is added to the 13 demo manifests that require it.

workbox-build was compiling against type-fest 0.16.0, hoisted from tempy,
rather than the 3.13.1 declared at the root. Using 3.13.1 fails with TS2411
on the WorkboxPackageJSON interface, so it is now a type alias with the same
shape.
@SuperDJ
SuperDJ force-pushed the chore/remove-unused-dependencies branch from 8000d11 to 52b5017 Compare November 6, 2026 10:41
@SuperDJ SuperDJ mentioned this pull request Nov 6, 2026
@YevheniiKotyrlo

Copy link
Copy Markdown

The published workbox-build@7.4.1 fails a consumer's type check the same way whenever the install hoists type-fest 3.0.0 or newer to the root, since build/types.d.ts resolves whatever type-fest is there.

npm install workbox-build@7.4.1 type-fest@5.10.0 typescript@7.0.2

tsconfig.json:

{ "compilerOptions": { "strict": true, "skipLibCheck": false, "noEmit": true, "module": "nodenext", "moduleResolution": "nodenext", "target": "es2022", "lib": ["es2022", "webworker"] }, "files": ["index.ts"] }

index.ts:

import type { WorkboxPackageJSON } from 'workbox-build/build/types';
export type T = WorkboxPackageJSON;

npx tsc -p .:

node_modules/workbox-build/build/types.d.ts(514,18): error TS2411: Property 'author' of type 'Person | undefined' is not assignable to 'string' index type 'JsonValue'.
node_modules/workbox-build/build/types.d.ts(514,18): error TS2411: Property 'bin' of type 'string | Partial<Record<string, string>> | undefined' is not assignable to 'string' index type 'JsonValue'.
...
node_modules/workbox-build/build/types.d.ts(515,5): error TS2411: Property 'workbox' of type '{ browserNamespace?: string | undefined; packageType?: string | undefined; prodOnly?: boolean | undefined; } | undefined' is not assignable to 'string' index type 'JsonValue'.

52 errors with type-fest@5.10.0, 50 with 4.41.0, 3.13.1 and 3.0.0; it checks clean with 2.19.0, 0.16.0 and 0.7.1. Node 26.12.1, npm 12.2.1, Windows 11.

WorkboxPackageJSON extended type-fest's PackageJson, so the published
build/types.d.ts resolved whatever type-fest a consumer had installed.
From type-fest 3.0.0 on, PackageJson carries a JsonValue index
signature that the optional fields don't satisfy, so consumers type
checking with skipLibCheck: false get ~50 TS2411 errors (reported on
PR GoogleChrome#3600 for type-fest 3.0.0 through 5.10.0).

Replace it with a local interface covering the fields workbox-build
reads (version, dependencies, workbox), so the published types no
longer depend on type-fest at all.

Removes 1 dependency (type-fest@3.13.1) from workbox-build's lockfile
(381 -> 380 packages).
@SuperDJ

SuperDJ commented Nov 16, 2026 •

Copy link
Copy Markdown
Author

@YevheniiKotyrlo Made another commit where type-fest is dropped as its usage was limited. It's replaced with a local interface covering the fields workbox-build reads (version, dependencies, workbox), so the published types no longer depend on type-fest at all.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants