Skip to content

Typecheck test/ and scripts/, not just src/ #39

Description

@dangrondahl

Description

tsconfig.json has include: ["src"] and excludes test, so npm run build typechecks only src/. Vitest doesn't typecheck either — it strips types and runs. That means neither test/ nor scripts/ is ever seen by the compiler.

Surfaced during the review of #28 (@types/node 22 → 26), where it materially weakened the evidence: a green CI run says nothing about whether a types bump broke test/client/kosli-client.test.ts (which asserts on FormData/Blob) or scripts/generate-catalog.ts (which imports node:fs and node:url). Those are exactly the files a @types/node major is most likely to affect, and they're outside the compiler's view.

This matters more now that #38 pins @types/node to the Node floor: the pin is only enforceable if tsc actually sees the code that would break.

Proposal

  • Add tsconfig.typecheck.json extending tsconfig.json, with noEmit: true and include: ["src", "test", "scripts"].
  • Add a typecheck script: tsc --noEmit -p tsconfig.typecheck.json.
  • Wire it into ci.yml as its own step, so a failure is distinguishable from a build or test failure.
  • Fix whatever it surfaces. Keep strict: true — don't loosen the config to make errors go away.

Keep the existing tsconfig.json as the emit config so npm run build still produces dist/ from src/ alone.

Tasks

  • Add tsconfig.typecheck.json
  • Add the typecheck npm script
  • Add a CI step
  • Fix surfaced type errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions