Skip to content

Support inheritance when generating TS interfaces #48

@guaycuru

Description

@guaycuru

Currently if I have

class ChildClass(ParentClass):
  something: str

class ParentClass(BaseModel):
  anything: str

The generated output is:

export interface ChildClass {
  something: string;
  anything: string;
}

export interface ParentClass {
  anything: string;
}

When a better output would be:

export interface ChildClass extends ParentClass {
  something: string;
}

export interface ParentClass {
  anything: string;
}

It seems https://github.com/bcherny/json-schema-to-typescript supports this. See this example.

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