Skip to content
Latchkey

TS2688: Cannot find type definition file for - in CI

A name listed in compilerOptions.types (or referenced via /// reference types) has no installed @types package.

What this error means

Type-checking fails with TS2688 naming the type package it cannot find under typeRoots.

tsc
error TS2688: Cannot find type definition file for 'jest'.

Common causes

How to fix it

Install the referenced types

  1. Install the @types package named in the types array
shell
npm i -D @types/jest

Remove the stale types entry

  1. Delete unused names from compilerOptions.types
  2. Verify typeRoots includes node_modules/@types
tsconfig.json
{
  "compilerOptions": {
    "types": ["node"]
  }
}

How to prevent it

  • Keep compilerOptions.types in sync with installed @types packages and prune entries you remove.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →