captbaritone / grats

Implementation-First GraphQL for TypeScript

Home Page:https://grats.capt.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Confusing lack of any output when putting docblock below decorators

captbaritone opened this issue · comments

@ObjectType({
  description: "A person who has composed opera.",
})
/** @gqlType */
export default class Composer  {
  @Field((type) => String)
  /** @gqlField */
  url(): string {
    return `/composer/${this._composer.id}`;
  }
}

Silently extracts zero things. Moving the docblocks above the decorators works, but we should error in this case if possible to show you where to find them.

Note that this is a special case of a broader problem. We don't have a way to discover detached comments. TypeScript does not expose these at all in the AST. We can look to typescript-eslint as a role model here. It (transitively) uses this:

https://github.com/JoshuaKGoldberg/ts-api-utils/blob/fcd3128b61dfb54978b30f07380ad1c87a5d093e/src/comments.ts#L76

Closed by #107