What TypeScript target should I use to compile Puppeteer-core types?

Puppeteer

To fix the TS18028 error, set the TypeScript target to ES2015 or higher. The error occurs because private identifiers (#) require ES2015+ emitted code. If esnext alone doesn't solve it, ensure you're using the right tsconfig and a recent TypeScript version.

Example tsconfig.json:

{
  "compilerOptions": {
    "target": "ES2015",
    "module": "ESNext",
    "lib": ["ES2015", "DOM"],
    "strict": true,
    "skipLibCheck": true
  }
}

Notes:

  • Some projects document the required target in tsconfig.base.json; ensure your project uses at least ES2015.
  • Install a recent TypeScript version locally and regenerate the config if needed:
npm install -D typescript
npx tsc --init