Suggestion: Generic OData response type
@nikithauc 已經在處理了。
開始於 2022年4月5日。
評估
這個 Issue 還沒有評估資料。
描述
I think this library should include a type to match the OData response signature, as these properties are very important to consider in certain scenarios and I don't think the library consumer should have to define this type themselves or have to rely on another library.
Concretely, I suggest an implementation that ideally enables the following Angular code to compile
(this.http as HttpClient)
.get<ExampleODataType<User>>('https://graph.microsoft.com/v1.0/me')
.subscribe((response) => {
console.log(response['@odata.context']);
console.log(response.displayName);
});
(this.http as HttpClient)
.get<ExampleODataType<User[]>>('https://graph.microsoft.com/v1.0/users?$count')
.subscribe((response) => {
console.log(response['@odata.count']);
console.log(response['@odata.nextLink']);
console.log(response.value[0].displayName);
});
A simpler alternative to this could be a Type containing just the OData properties which one can make intersections with
(this.http as HttpClient)
.get<User & ExampleODataType>('https://graph.microsoft.com/v1.0/me')
.subscribe((response) => {
console.log(response['@odata.context']);
console.log(response.displayName);
});
(this.http as HttpClient)
.get<{ value: User[] } & ExampleODataType>('https://graph.microsoft.com/v1.0/users?$count')
.subscribe((response) => {
console.log(response['@odata.count']);
console.log(response['@odata.nextLink']);
console.log(response.value[0].displayName);
});
- 主要語言
- PowerShell
- 星號
- 129
- 分支
- 35
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoftgraph/msgraph-typescript-typings 的其他 Issue
-
status:waiting-for-triage type:bug
難度 2/5 1-3 小時 新手友好度 48/100
microsoftgraph/msgraph-typescript-typings#756 · 1 個 reaction ·
-
status:waiting-for-triage type:bug
難度 4/5 3-5 天 新手友好度 35/100
microsoftgraph/msgraph-typescript-typings#748 · 2 個 reaction ·
-
status:waiting-for-triage
難度 2/5 1-3 小時 新手友好度 48/100
-
status:waiting-for-triage type:feature
難度 4/5 3-5 天 新手友好度 35/100
-
難度 3/5 1-2 天 新手友好度 35/100
microsoftgraph/msgraph-typescript-typings#530 · 1 個 reaction ·