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.

Frequently asked questions

What causes "TS2688 type definition file"?
Type-checking fails with TS2688 naming the type package it cannot find under typeRoots.
How do I fix TS2688 type definition file?
Install the referenced types

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card