Skip to content

Allow function fields to be generic #135

Description

@captbaritone
/** @gqlField */
export function nodes<T>(connection: Connection<T>): T[] {
  return connection.edge.map(edge => edge.node);
}

Should act as a functional equivalent of a method on a generic class:

/** @gqlType */
class Connection<T> {
  // ... other fields/methods
  nodes(): T[] {
    return this.edges.map(edge => edge.node)
  }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions