Skip to content

Root config files are not type-checked #246

Description

@sasha-id

Split out of the review on #245, where this bit for real.

tsconfig.json has "include": ["src"], so nothing type-checks the root config files — vite.config.ts, vitest.browser.config.ts, vitest.setup.ts, docker/*.mjs. npm run typecheck is clean whatever they contain.

How it showed up

#212 added a test: block to vite.config.ts; #245 added one too, in a different place. Git merged both without a conflict and left a duplicate object key:

export default defineConfig({
  test: { setupFiles: ["./vitest.setup.ts"] },   // #212
  build: {},
  test: { exclude: [...] },                      // #245 — silently wins
});

The second key wins, setupFiles is dropped, and with it the PointerEvent polyfill that src/replay-history/history-replay.test.ts depends on. The symptom is two failures in a file neither PR touched, which is a misleading place to start debugging. tsc says nothing, because it never looks at the file. npm test does catch it, so CI would not let it through — but only after a detour.

TypeScript reports duplicate object keys (ts(1117)) when it checks the file at all. It just never checks this one.

What would close it

Add the root config files to the type-check. Either widen include, or keep the app's tsconfig.json narrow and add a tsconfig.node.json covering the config files, with npm run typecheck running both. A typo'd Vite or Vitest option is the same class of silent failure, so the value is not only the duplicate key.

Activity

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions