Not fully understanding the purpose of this project

Đang mở
#245 3 bình luận 12 reaction 1 người được giao Xem trên GitHub

@nikithauc đang làm issue này rồi.

Từ ngày 7/4/2021.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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

Ngôn ngữ chính
PowerShell
Star
129
Fork
35
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoftgraph/msgraph-typescript-typings

Tất cả issue của microsoftgraph/msgraph-typescript-typings

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.