Suggestion: creation of a generic collection type

Aperta
#530 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
typescript
Ambito
api

Direzione di ricerca

Start by reading the TypeScript definitions for collection response types and the Client.api(...).get() typing used for /me/events. Check how existing collection types represent their value arrays and whether they can be generalized for different item types. Done means the typings expose a reusable generic collection type and the event response can use it; the issue names no files or tests.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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?

Lingua principale
PowerShell
Stelle
129
Fork
35
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoftgraph/msgraph-typescript-typings

Tutte le issue di microsoftgraph/msgraph-typescript-typings

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.