typescript-rest-swagger icon indicating copy to clipboard operation
typescript-rest-swagger copied to clipboard

problem with interface extends interface

Open niklas-dahl opened this issue 4 years ago • 0 comments

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.

niklas-dahl avatar Oct 27 '20 11:10 niklas-dahl