thiagobustamante / typescript-rest-swagger

Swagger tools for typescript-rest
156 stars 57 forks source link

problem with interface extends interface #130

Open niklas-dahl opened 4 years ago

niklas-dahl commented 4 years ago

Hey, thanks for this package. We are running into problems when extending interfaces.

Minimal problem reproduction:

types.ts

export interface Comment {
  comment: string;
}

export interface UserComment extends Comment {
  user: string;
}

routes.ts

@Path(":name")
  @POST
  async userComment(): Promise<UserComment> {
    return {
      user: "user",
      comment: "comment",
    };
  }

using the UserComment type results in the following error

/../typescriprestupdate/node_modules/typescript-rest-swagger/dist/metadata/resolveType.js:267
        throw err;
        ^

Error: Only string indexers are supported. Found double.
    at /../typescriprestupdate/node_modules/typescript-rest-swagger/dist/metadata/resolveType.js:507:23

Thanks.