Skip to content

Suggestion: creation of a generic collection type #530

Description

Hi,

So I am doing requests to retrieve an array of events, and I noticed that there aren't many types for collections.
If i do the following:

const options = {
	authProvider,
};
const client = Client.init(options);
let events = await client.api('/me/events').get();

Then events will be an object with the property value being an array of events.
Maybe this could be added to the typings to solve this:

export interface GenericCollection<T> {
  value?: NullableOption<Array<T>>;
}

Where T could be any type that has support for lists which could be declared using a type to limit the options.

Hope this is a good idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions