openapi-typescript-codegen: Type error: Private identifiers are only available when targeting ECMAScript 2015 and higher.

Describe the bug I have "target": "ES2022" then also i am getting Type error: Private identifiers are only available when targeting ECMAScript 2015 and higher..

I am using NextJS

image

About this issue

  • Original URL
  • State: open
  • Created 5 months ago
  • Reactions: 1
  • Comments: 22

Most upvoted comments

@jordanshatford Thank you very much for your work and your responsiveness. I’ve just updated the package and it works perfectly ❤️

@valentin-harrang this has been fixed in v0.31.0 of @hey-api/openapi-ts

@valentin-harrang thanks for testing that. I should have some time later today to check it out and figure out what’s causing it.

@sagardwivedi I have the same problem. Have you fixed your problem?

I use Next.js 14 with TypeScript and I tried to exclude src/types/generated directory by adding this line is tsconfig.json file:

"exclude":["node_modules","src/types/generated/**/*.ts"]

but I still get the error when I run npm run build or npx tsc.

image

To temporarily fix the problem I added @ts-ignore but it’s not ideal, I shouldn’t have to do that.

    // @ts-ignore
    #isResolved: boolean;
    // @ts-ignore
    #isRejected: boolean;
    // @ts-ignore
    #isCancelled: boolean;
    // @ts-ignore
    readonly #cancelHandlers: (() => void)[];
    // @ts-ignore
    readonly #promise: Promise<T>;
    // @ts-ignore
    #resolve?: (value: T | PromiseLike<T>) => void;
    // @ts-ignore
    #reject?: (reason?: any) => void;