Skip to content

Type errors in generated code (TS2310, TS2506, TS2345) #70

@beeman

Description

@beeman

When generating coding using "@tim-smart/openapi-gen": "^0.4.13" I get various type errors:

src/generated/forgejo.ts:775:14 - error TS2310: Type 'Repository' recursively references itself as a base type.
775 export class Repository extends S.Class<Repository>("Repository")({
                 ~~~~~~~~~~
src/generated/forgejo.ts:775:14 - error TS2506: 'Repository' is referenced directly or indirectly in its own base expression.
775 export class Repository extends S.Class<Repository>("Repository")({
                 ~~~~~~~~~~
src/generated/forgejo.ts:827:28 - error TS2345: Argument of type 'typeof Repository' is not assignable to parameter of type 'All'.
827   "parent": S.optionalWith(Repository, { nullable: true }),
                               ~~~~~~~~~~

I created a reproduction based on the Effect CLI template.

The things I did after generating the CLI app was:

  • update all the deps to the latest (especially so that TypeScript is up to date)
  • downloaded the swagger file from a local forgejo instance
  • run the generator with these parameters

When I open the generated code in my IDE there's a sea of red.

In addition, running pnpm run check yields the same error - CI also reflects this.

I tried fooling the system with a @ts-ignore on top of the generated file 🙈 but that doesn't seem to help.

Any pointers to what I'm doing wrong here are very welcome!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions