openapi-react-query-codegen icon indicating copy to clipboard operation
openapi-react-query-codegen copied to clipboard

Error: Method block not found

Open vahidvdn opened this issue 10 months ago • 9 comments

Describe the bug When I want to run yarn codegen , It throws this error:

Error: Method block not found

And with version "v2.0.0-beta.1", I get this error:

Error: Variable declaration not found

To Reproduce just run : yarn codegen

OpenAPI spec file https://github.com/7nohe/openapi-react-query-codegen/blob/main/examples/petstore.yaml

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots or logs to help explain your problem.

  • OS: [e.g. macOS]
  • Version ^1.6.2

Additional context Add any other context about the problem here.

vahidvdn avatar Jan 27 '25 15:01 vahidvdn

Did you ever find a solution for this? I'm facing the same problem

claudioBarreira89 avatar Apr 08 '25 11:04 claudioBarreira89

@claudioBarreira89 Unfortunately not. I just used Orval. It just works fine.

vahidvdn avatar Apr 08 '25 11:04 vahidvdn

Just realised I was missing a peer depencency ts-morph. It worked after adding it!

claudioBarreira89 avatar Apr 08 '25 11:04 claudioBarreira89

Interesting! However, it's not mentioned anywhere, or at least I didn't see it

vahidvdn avatar Apr 08 '25 11:04 vahidvdn

We tried adding ts-morph as a peer dependency to our project, but it didn't help. This error prevents us from updating to TypeScript v5.9.2.

Etsija avatar Aug 08 '25 04:08 Etsija

Are there any updates to this? It is still totally blocking us from updating TypeScript post v5.9.2.

Etsija avatar Aug 26 '25 05:08 Etsija

Just realised I was missing a peer depencency ts-morph. It worked after adding it!

Thanks @claudioBarreira89, this fixed it for me.

christopher-caldwell avatar Sep 17 '25 17:09 christopher-caldwell

Just realised I was missing a peer depencency ts-morph. It worked after adding it!

For me worked only after update of ts-morph till latest version. Thanks!

PEvgeniya avatar Oct 08 '25 14:10 PEvgeniya

Also hitting this - any chance the maintainer could update the repo to help others?

amcdnl avatar Nov 04 '25 13:11 amcdnl

Hi @amcdnl have you tried installing ts-morph? I did npm install -D ts-morph and it solved the issue for me.

Thanks to @claudioBarreira89 https://github.com/7nohe/openapi-react-query-codegen/issues/178#issuecomment-2786107759

The-Lone-Druid avatar Dec 09 '25 07:12 The-Lone-Druid