Not fully understanding the purpose of this project

Ouverte
#245 3 commentaires 12 réactions 1 personne assignée Voir sur GitHub

@nikithauc y travaille déjà.

Depuis le 7/4/2021.

Évaluation

Cette issue n'a pas encore été évaluée.

Description

question

Hi there.
I've been using the microsoft graph client and the types in this repo.

The thing I don't fully understand, is why the types are separate from the microsoft graph client project, and why I need to explicitly typecast. It relies on me, the consumer, knowing the types ahead of time. I don't know the request or response data schema for all the endpoints, so how am I supposed to typecast? This approach seems a little risky to me, I could be typecasting wrong and could be using the wrong data structures.

Can someone clarify the situation and explain the microsoft graph client doesn't just use the types in this repo? It would make consumers's lives a lot better!

The client should provide the types for every endpoint. In the example below, as i consumer, I expect the client to tell me the types it expects:

// `user` should be typed by default
// the return type should be typed by default
client.api(`/users/${id}`).patch(user);

If the types cannot be combined with the client, can i suggest a slightly better approach (imo) for handling types. Instead of typecasting we can use generics:

client.api(`/users/${id}`).patch<RequestType, ResponseType>(user);

AB#8842

Langage dominant
PowerShell
Étoiles
129
Forks
35
Métriques de merge des PR
Aucune PR mergée en 30 j

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de microsoftgraph/msgraph-typescript-typings

Toutes les issues de microsoftgraph/msgraph-typescript-typings

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.