---
id: "packages/typescript-config/checks"
title: "Checks and troubleshooting"
description: "How to see the configuration TypeScript computes, run the type-check, compare your copy, and read common errors."
url: "/packages/typescript-config/checks"
locale: "en"
revision: "68337947632a3f80"
---

# Checks and troubleshooting

## See the effective configuration

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

```bash
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

```bash
pnpm exec tsc --noEmit
```

| Result | Exit code |
| --- | --- |
| no type errors | 0 |
| one type error or more | 2 |

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:

```bash
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

| Error | Cause and remedy |
| --- | --- |
| `TS6053: File '@workspace/typescript-config/…' not found` | the 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 set` | the type-check reaches a `.tsx` file of a dependency; use `react-library.json` ([Presets](/packages/typescript-config/presets#choosing-a-preset)) |
| `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 app | `next-env.d.ts` is missing from `include`, or `next` is not installed in the app |
