Type Check
Run full TypeScript type checking while filtering diagnostics to only project-owned files, keeping strict configs practical in real-world projects.
Summary
The type-check command uses the TypeScript compiler API to run getPreEmitDiagnostics against a project, then filters the results to only include errors in files owned by the project. Third-party diagnostics (from node_modules) are excluded so that skipLibCheck: false can be used without surfacing errors in dependencies the project maintainer cannot control.
Setting skipLibCheck: false in a TSConfig preset catches more bugs, but it also surfaces errors inside third-party packages. This command gives you the strictness without the noise.
Why Use This Command?
- Catch type errors in project code that
skipLibCheck: truewould normally hide. - Keep
skipLibCheck: falsein shared TSConfig presets without blocking CI on third-party issues. - Produce clear, file-scoped diagnostics with line and column numbers for quick navigation.
- Replace manual
tsc --noEmitinvocations that may report uncontrollable errors.
Use Cases
- Monorepo maintenance — Run type checks per workspace with each workspace's own
tsconfig.json. - CI/CD pipelines — Add a type-check step that exits with code 1 on project errors while ignoring dependency noise.
- Strict TSConfig adoption — Migrate from
skipLibCheck: truetofalseincrementally by surfacing only your own errors. - Pre-commit checks — Confirm type safety before committing without waiting for a full build.
Requirements
- Node.js runtime — Use any Node.js LTS release with either the installed
novaCLI ornpx. - TypeScript — Must be installed as a dependency (direct or peer) in the workspace.
- tsconfig.json — A valid TypeScript configuration file must exist in the workspace (or be specified with
--project).
Usage
You can run this command in two ways:
- nova (installed)
- npx (no install)
# Original
nova utility type-check
# Shorthand
nova util type-chk
Note: If Nova is installed only locally (inside a project), the command will work only within that project's directory. See the npm docs for details.
# Original
npx --yes @cbnventures/nova@latest utility type-check
# Shorthand
npx --yes @cbnventures/nova@latest util type-chk
Note: If you prefer the shorter nova command, see the Setup and Configure guide for installation instructions.
Options
| Flag | Description |
|---|---|
-p, --project <path> | Path to tsconfig.json. |
When --project is omitted, the command searches for tsconfig.json starting from the current working directory.
How It Works
- Resolve config — Locate the
tsconfig.jsonfile from--projector by searching from the current directory. - Parse config — Read and parse the TypeScript configuration using the compiler API.
- Create program — Build a full TypeScript program from the parsed file list and compiler options.
- Collect diagnostics — Run
getPreEmitDiagnosticsto gather all type errors, including those insidenode_modules. - Filter — Keep only diagnostics where the source file starts with the current working directory and does not contain
node_modulesin its path. - Report — Print each error with file path, line, column, and message, then exit with code 1 if any errors remain.
The command exits with code 1 when project-owned type errors are found. CI pipelines that use this command will fail the step on type errors.
Examples
- nova (installed)
- npx (no install)
# Original
nova utility type-check
# Shorthand
nova util type-chk
# Original
nova utility type-check --project ./tsconfig.build.json
# Shorthand
nova util type-chk -p ./tsconfig.build.json
# Original
npx --yes @cbnventures/nova@latest utility type-check
# Shorthand
npx --yes @cbnventures/nova@latest util type-chk
# Original
npx --yes @cbnventures/nova@latest utility type-check --project ./tsconfig.build.json
# Shorthand
npx --yes @cbnventures/nova@latest util type-chk -p ./tsconfig.build.json
Troubleshooting
- No tsconfig.json found — Confirm a
tsconfig.jsonexists in the current directory, or pass the correct path with--project. - TypeScript not installed — The command requires TypeScript as a dependency. Run
npm install typescriptif it is missing. - Zero errors but build fails — This command only checks types; build errors from bundlers or other tools are not covered.
- Errors in generated files — If generated files (e.g.,
.docusaurus) appear in diagnostics, add them to theexcludearray in yourtsconfig.json.