Skip to content

apps/console/tsconfig.node.json never type-checks — 5 standing errors, including two that say the compression options are typed wrong #3305

Description

@xuyushun441-sys

Found while working #3297 (console build config). Not fixed there — unrelated to that change, filing per PD #10.

What

apps/console/tsconfig.node.json is the project that covers vite.config.ts. Nothing runs it:
the console's build script is tsc && vite build && pnpm build:plugin, and plain tsc reads
tsconfig.json (include: ["src", "dev", "objectstack.config.ts"]), which does not build
project references. So the config file that decides how the console is bundled is the one file
in the app that no gate reads.

Running it directly on a clean origin/main (f44d8727f):

$ pnpm exec tsc -b apps/console/tsconfig.node.json --force
apps/console/vite.config.ts(6,32): error TS6307: File '.../scripts/vite-crypto-stub.ts' is not listed within the file list of project '.../apps/console/tsconfig.node.json'. Projects must list all files or use an 'include' pattern.
apps/console/vite.config.ts(183,9): error TS2561: Object literal may only specify known properties, but 'algorithm' does not exist in type 'ViteCompressionPluginOption'. Did you mean to write 'algorithms'?
apps/console/vite.config.ts(188,9): error TS2561: Object literal may only specify known properties, but 'algorithm' does not exist in type 'ViteCompressionPluginOption'. Did you mean to write 'algorithms'?
apps/console/vite.config.ts(286,3): error TS2769: No overload matches this call.
  The last overload gave the following error.
    Object literal may only specify known properties, and 'test' does not exist in type 'UserConfigExport'.
scripts/vite-crypto-stub.ts(1,29): error TS2307: Cannot find module 'vite' or its corresponding type declarations.

Three separate problems in one file:

  1. algorithm vs algorithms (x2) — the two compression({ algorithm: 'gzip' | 'brotliCompress' })
    calls use a key vite-plugin-compression2's current types do not declare. Empirically the
    build still emits both .gz and .br, so the runtime honours it and this is a types/runtime
    mismatch rather than broken compression — but nobody could tell from the config, and the day
    the plugin drops the old key the console silently ships one algorithm twice.
  2. scripts/*.ts are unresolvable from this project — TS6307 (not in the file list) plus
    TS2307 (vite itself is not resolvable from scripts/, which has no package.json and sits
    outside every package that depends on Vite). Any shared vite plugin living in scripts/
    inherits this, so its Plugin/ResolvedConfig types quietly degrade.
  3. test on the config object — the vitest block in vite.config.ts is not in
    UserConfigExport; it type-checks only via vitest/config's defineConfig.

Why it matters

This is the same shape as the gap scripts/check-type-check-coverage.mjs was written to close:
a file everyone assumes is checked, that no command actually checks. Its own header says a package
without a type-check script "is not 'passing', it is unchecked" — that reasoning applies one
level down to a project reference nothing builds.

Suggested direction (not decided)

  • Give the project an include that covers the scripts/*.ts plugins it imports, or move them
    somewhere with real Vite types on the resolution path.
  • Fix algorithm to whatever the installed vite-plugin-compression2 declares, and confirm both
    algorithms still emit.
  • Import defineConfig from vitest/config in vite.config.ts so the test block is typed.
  • Then wire the project into a gate so it cannot rot again.

Deliberately left unassigned.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions