acacode / acacode/swagger-typescript-api

header in baseApiParams has wrong type in Typescript

Đang mở
#694 0 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
4.1k
Fork
436
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

https://github.com/acacode/swagger-typescript-api/blob/2b6db2346028fe6fb1f311bf5b1221a89837032e/templates/base/http-clients/fetch-http-client.ejs#L123-L130

according to typescript, `baseApiParams.header` is shape of `HeaderInit`.
and `type HeadersInit = [string, string][] | Record | Headers;`

and header is expand in the code above,
- expand `Headers` instance will result to `{}`
- expand `[string, string][]` will result to `{0: [string, string]}`

only `Record` will work as expected

we need to narrow `baseApiRarams.header`'s type to `Record` in `type RequestParams`

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

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

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.