grats icon indicating copy to clipboard operation
grats copied to clipboard

Make classes and interfaces inherit GraphQL fields and interfaces from classes they extend and interfaces they implement

Open captbaritone opened this issue 1 year ago • 2 comments
trafficstars

/** @gqlType */
class Parent {
  /** @gqlField */
  parentField: string;
}

class Intermediate extends Parent {}

/** @gqlType */
export class Child extends Intermediate {
  /** @gqlField */
  childField: string;
}

Would now extract:

type Child {
  childField: String
  parentField: String
}

type Parent {
  parentField: String
}

This change also allows you to define GraphQL interfaces using TypeScript types.

TODO

  • [ ] Documentation
  • [x] Integration tests
  • [ ] Validate/test method resolution order
  • [x] Don't use private methods/properties of the typecontext
  • [x] Add caching to avoid duplicate recursion in heritage propagation
  • [x] Changelog (this is a breaking change!)

captbaritone avatar Jul 09 '24 07:07 captbaritone