Typecheck one or more TypeScript files while resolving the TypeScript version from the target module(s), not from this CLI.
npm install -D @kentcdodds/typecheck-modulesnpx @kentcdodds/typecheck-modules <file|dir|glob ...>
typecheck-modules <file|dir|glob ...>
node ./cli.js <file|dir|glob ...>Examples:
typecheck-modules ./playground
typecheck-modules ./playground/index.ts
typecheck-modules "./playground/**/*.{ts,tsx}"
typecheck-modules --ignore "**/*.test.ts" ./playground- Resolves
typescriptfrom the nearestnode_modulesabove each module (using the closestpackage.jsonwhen available). - If a
tsconfig.jsonis found, it uses those compiler options. - If no
tsconfig.jsonis found, it falls back to TypeScript defaults and warns once per directory group (similar totsc file.tsbehavior). - Accepts directories and searches recursively for
.tsand.tsx. - Accepts globs cross-platform (no shell expansion required).
- Normalizes directory/glob paths for
fast-globon Windows (backslash path separators).
By default, these are ignored during directory and glob expansion:
node_modules,.git,dist,build,out,.cache,coverage,test-output,test-results,test-reports
Provide --ignore to replace the defaults entirely:
typecheck-modules --ignore "**/*.test.ts" ./playground
typecheck-modules --ignore "**/fixtures/**" "./playground/**/*.ts"MIT