Skip to content

TypeScript 7 support (solution) #4235

Open

Description

@MrShtrahman

Description

After updating to typescript@7 in my project and running openapi-ts, I get this error:

/node_modules/.pnpm/@[email protected][email protected]/node_modules/@hey-api/openapi-ts/dist/init-D6Y8JFUS.mjs:4017
        any: ts.SyntaxKind.AnyKeyword,
                           ^

TypeError: Cannot read properties of undefined (reading 'AnyKeyword')

Downgrading back to [email protected] seems to work fine

I'm using @hey-api/openapi-ts version 0.99.0

Reproducible example or configuration

Just install typescript@7 and run openapi-ts :)

OpenAPI specification (optional)

No response

System information (optional)

pnpm version 10.34.4
node version 24

Activity

  1. added
    bug 🔥
    on Jul 9, 2026
  2. pullfrog commented on Jul 9, 2026

    @pullfrog
    Contributor
  3. L4Ph commented on Jul 9, 2026

    @L4Ph

    Most details are covered in the TypeScript release notes, so I won't go into too much depth here, however, the Compiler API is not yet supported, so it cannot be used.

  4. guilhem commented on Jul 9, 2026

    @guilhem

    changing

    -      from "typescript"
    +      from "@typescript/typescript6"
    

    add compatibility

  5. mrlubos commented on Jul 9, 2026

    @mrlubos
    Member

    @MrShtrahman try with npm i @hey-api/openapi-ts@next!

    EDIT: Please pin to the version that works for you.

  6. mrlubos commented on Jul 9, 2026

    @mrlubos
    Member

    I'll keep this issue open for anyone looking for the answer

  7. MrShtrahman commented on Jul 10, 2026

    @MrShtrahman
    Author

    Thanks! @mrlubos solved the issue 😀 I'll wait for it to come in the next release

  8. mrlubos commented on Jul 10, 2026

    @mrlubos
    Member

    @MrShtrahman Yep! It completely removes any dependency on TypeScript so we're no longer limited by that package. Shout out to @ahmedrowaihi for implementing this!

  9. changed the title [-]openapi-ts fails with typescript 7[/-] [+]openapi-ts fails with typescript 7 (solution)[/+] on Jul 10, 2026
  10. added
    docs 📃
    feature 🚀
    important 📌
    on Jul 10, 2026
  11. cmgriffing commented on Jul 10, 2026

    @cmgriffing

    I would just like to add to this. I am not using TS7 myself. I am just calling this package using this:

    pnpx @hey-api/openapi-ts \
      -i ./openapi.yaml \
      -o ./sdk \
      -c @hey-api/client-fetch
    

    I get the same exact error as OP. Switching to the @next version fixes it.

  12. 33 remaining items

  13. gruckion commented on Oct 21, 2026

    @gruckion

    Hi team anything I can do to speed up the next release it's been 4 months.

    Happy to help in anyway needed. Really need this ts7 fix to land. ❤️

  14. YuriiMotov commented on Oct 21, 2026

    @YuriiMotov

    Hi team anything I can do to speed up the next release it's been 4 months.
    Happy to help in anyway needed. Really need this ts7 fix to land. ❤️

    @gruckion, I guess https://github.com/sponsors/hey-api is one of such things :)

  15. michaelboyles commented on Oct 21, 2026

    @michaelboyles

    I keep getting notifications for this thread (turning them off now), but I'd just like to emphasise a comment I already made:

    For anyone waiting for a heyapi release, you can run both TS v6 for compat with heyapi, and still use v7 for your builds.

    Microsoft describe the workaround in their release notes

    https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/#running-side-by-side-with-typescript-6.0

    There is absolutely zero reason you should be hassling the author to release a new version. Just run both.

  16. sebastianvitterso commented on Oct 21, 2026

    @sebastianvitterso

    @michaelboyles I disagree. The effort for the author to perform a release (or recruit someone to the core dev team to do it for him) would be fairly small, compared to all dependants having to run a compatability mode.

    For some teams, having two typescript installations running in parallell is enough of an inconvenience that migrating to kubb or orval may be just as practical.

    Not to mention some reported bugs should also be addressed in the requested release.

    There is a lot of people using this for production applications, because they think it's a great piece of software. So we'd all just love if it stayed up to date with the ecosystem (e.g. TS7).

  17. michaelboyles commented on Oct 21, 2026

    @michaelboyles

    @sebastianvitterso the comment before this says "Really need this". You objectively do not "need" anything. You can work around it very easily

    It also said "it's been 4 months". Yeah, 4 months of people being ignorant of the simple workaround that I implemented 2 months ago and told everyone about, which was apparently mostly ignored

    No sympathy from me, sorry. Fund the work, apply the workaround, or be patient. Those are your options

  18. sebastianvitterso commented on Oct 22, 2026

    @sebastianvitterso

    @michaelboyles I hear you, and I'm sure a lot of people did apply your workaround, given that the npm package has 2M weekly downloads.

    My point is just that once an open source project sees this level of use, I think it would be more responsible to also onboard at least one or two extra team members to the core team that can merge pull requests and create releases.

    The community at large are more than willing to fix the issues, someone just has to click the final few buttons.

  19. vojty commented on Oct 23, 2026

    @vojty

    It's definitely not about "just click the final few buttons"...

    By the way, @mrlubos would you mind sharing the current status of the project? The latest pre-release works very well, so I'm not waiting on anything in particular.
    I just noticed that PRs have been locked and there haven’t been any commits to the main branch for a few weeks, so I was curious whether you're taking a short break, working on something privately ahead of an update, or something else entirely. Since the project seems to rely on a single maintainer, I'm also a little curious how bugs and potential CVEs would be handled going forward, though it's totally fine if there’s no clear plan yet.

  20. remhentiebra commented on Oct 26, 2026

    @remhentiebra

    Thanks for the @next workaround! We tested 0.0.0-next-20260930190945 with TypeScript 7.0.2, and it works well for us.

    One complication we ran into: the 0.0.0-next-… version falls below the <0.97.3 affected range in GHSA-hhx9-57xq-r5rw. Renovate therefore proposed replacing our prerelease pin with 0.97.3 as a security update, which brought back the TS7 incompatibility.

    We checked the generated code and couldn’t reproduce the advisory’s issue with the prerelease, so this appears to be a version-range mismatch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🔥docs 📃feature 🚀important 📌

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions