Error 2310, "Type 'A' recursively references itself as a base type," typically occurs when TypeSc...

If I want to add annotations to a schema, and I add an examples array to them, I get a
Type 'A' recursively references itself as a base type.(2310)
Error message in some cases.
Example:
export class HTTPMessageResponse extends Schema.Class<HTTPMessageResponse>(
  "HTTP_MessageResponse",
)({
  message: Schema.NonEmptyTrimmedString,
  additionalObjects: Schema.Array(Schema.Object),
}).pipe(
  Schema.annotations({
    identifier: "HTTPMessageResponse",
    description: "Simple success message response from the API, which may contain additional objects. If there are additional Objects, they will be described in the API Specification.",
    examples: [{
      message: "Sheesh, what a wonderful response message",
      additionalObjects: []
    }]
  })
) {}

Gives me that error.
However, if I extend from that class, everything is working fine.
Working example:
export class HTTPUserDatabaseResponse extends UserSchema.pipe(
  Schema.annotations({
    identifier: "HTTPUserDatabaseResponse", 
    description: "User object from the backend database.",
    examples: [{
      is_admin: false,
      is_course_manager: false,
      is_disabled: false,
      issuer: "local",
      pk: 1,
      public_id: "a0a0a0a0-a0a0-a0a0-a0a0-a0a0a0a0a0a0",
      username: "What a stupid username"
    }]
  })
) {}

In most of the cases I don't want to that.
Are there other solutions?
Was this page helpful?