Search documentation

Search all pages, headings and text, in the current package or topic or in all documentation.

Checks and troubleshooting

How to see the configuration TypeScript computes, run the type-check, compare your copy, and read common errors.

@workspace/typescript-config 1.0.0Developmentunreleased, maintained in Foundation as a copy

See the effective configuration#

Print what TypeScript computes from the three layers, in the folder of the tsconfig.json:

Terminal
pnpm exec tsc --showConfig

For a package on nodejs.json with only include and exclude of its own, the compiler options read (followed by files, include and exclude; TypeScript may add options it derives, such as preserveConstEnums):

JSON
{  "compilerOptions": {    "declaration": true,    "declarationMap": true,    "esModuleInterop": true,    "incremental": false,    "isolatedModules": true,    "lib": ["es2022", "esnext.temporal"],    "module": "esnext",    "moduleDetection": "force",    "moduleResolution": "bundler",    "noUncheckedIndexedAccess": true,    "resolveJsonModule": true,    "skipLibCheck": true,    "strict": true,    "target": "es2022",    "types": ["node"],    "noEmit": true  }}

Check there that strict and noUncheckedIndexedAccess arrive, that lib, types and jsx are those of the preset you meant, and, under files, which files the project holds. To see why a file is part of the project, add --explainFiles to a type-check.

Run the type-check#

Terminal
pnpm exec tsc --noEmit
ResultExit code
no type errors0
one type error or more2

There is no threshold: unlike lint, a single error fails the run. Which packages are checked, and by which root script, is your repository's choice, for example turbo typecheck --continue or pnpm -r --no-bail typecheck.

Check your copy#

The package arrives as a copy, so no applier checks it. Compare it with Foundation's state:

Terminal
diff -rq -x node_modules -x .turbo <foundation>/packages/typescript-config packages/typescript-config

No output means equal. Any difference is either a newer state in Foundation, to take over as a whole, or a local edit, which is a defect to undo.

Common errors#

ErrorCause and remedy
TS6053: File '@workspace/typescript-config/…' not foundthe package is not declared at the root, not installed, or the file name is wrong: one of nodejs.json, react-library.json, nextjs.json
TS2532: Object is possibly 'undefined' on values[0]noUncheckedIndexedAccess: check the element, or use values[0] ?? fallback
TS2584: Cannot find name 'document'DOM code under nodejs.json; if the package really runs in a browser, it needs react-library.json
TS6142: Module '…' was resolved to '….tsx', but '--jsx' is not setthe type-check reaches a .tsx file of a dependency; use react-library.json (Presets)
TS2591: Cannot find name 'process'no Node types: add "types": ["node"] (with @types/node installed), keeping any types the preset had
TS7026: JSX element implicitly has type 'any' in a Next.js appnext-env.d.ts is missing from include, or next is not installed in the app

This page as Markdown