Guide
Check a TypeScript project
A TypeScript check analyzes the files selected by a project's configuration and reports incompatible types.
At a glance
- Configuration file
- tsconfig.json
- Check without output
- tsc --noEmit
Overview
A TypeScript check analyzes the files selected by a project's configuration and reports incompatible types. Use the project's existing compiler setup so that the result reflects its real environment, then resolve the underlying mismatch and rerun the relevant check.
1. Find the project configuration
Read the project's package scripts and tsconfig.json to identify the intended check command and selected files. Prefer the installed project compiler so its behavior matches the version used by the rest of the team.
2. Run the check
Run the documented script or the configured compiler with --noEmit when only validation is needed. Read the first relevant error with its surrounding code rather than treating the total error count as the diagnosis.
3. Repair and verify
Fix the mismatch at its source, such as an incorrect input type or an unhandled optional value. Rerun the check and exercise runtime behavior where types cannot establish that the application does the right thing.
Sources and review
MOOR's explanatory text is supported by the following source links.
- The basics — TypeScript
- What is a tsconfig.json? — TypeScript