What target should I set for TypeScript to build Puppeteer types with tsc?

Puppeteer

If you run into TS18028 private identifiers errors when compiling Puppeteer types with TypeScript, set the TypeScript target to ES2020 or newer. Example tsconfig snippet:

{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ESNext",
    "lib": ["dom", "es2020"],
    "strict": true
  }
}

Notes:

  • Use a TypeScript version that supports private identifiers (TS 4.x+).
  • If your environment requires older targets, you may need to avoid using private class fields or adjust downlevel.