Skip to content

Feature: Better API for registering objects #2

Description

@Rodentman87

Currently, the API for registering objects doesn't work well for adding features without getting very verbose, and has potential for breaking changes to the API. The API should be switched to options passed as an object so that new options can be added without creating a breaking change.

Current API

registerListType<T extends DataLoadedListEntry>(
    object: new (id: string, manager: DataLoadedListEntryManager<any>) => T,
    queryName: string,
    typename?: string,
    idName: string = "id",
    idType: string = "ID!"
  )

registerObject<T extends DataLoadedObject>(
    object: new (...args: any[]) => T,
    queryName: string,
    typename?: string
  )

Proposed API

registerListType<T extends DataLoadedListEntry>(
  object: new (id: string, manager: DataLoadedListEntryManager<any>) => T,
  options: ListTypeOptions,
 )

registerObject<T extends DataLoadedObject>(
    object: new (...args: any[]) => T,
    options: ObjectTypeOptions,
  )

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

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions