Skip to content

TypeScript error when using with Vitest + Next.js and "skipLibCheck": false #19

@elliottsj

Description

@elliottsj

Next.js uses "target": "es5" due to reasons described here.

So next build fails due to a type error when tinybench is present via Vitest:

../../node_modules/.pnpm/tinybench@2.1.5/node_modules/tinybench/dist/index.d.ts:254:5
Type error: Private identifiers are only available when targeting ECMAScript 2015 and higher.

  252 |  */
  253 | declare class Bench extends EventTarget {
> 254 |     #private;
      |     ^
  255 |     signal?: AbortSignal;
  256 |     warmupTime: number;
  257 |     warmupIterations: number;

I have "skipLibCheck": false, so setting "skipLibCheck": true would be a workaround, but I'd lose type safety.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions