Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: creation of a generic collection type #530

Open
BillyCottrell opened this issue Jan 16, 2024 · 0 comments
Open

Suggestion: creation of a generic collection type #530

BillyCottrell opened this issue Jan 16, 2024 · 0 comments

Comments

@BillyCottrell
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant