acacode / acacode/swagger-typescript-api

header in baseApiParams has wrong type in Typescript

未关闭
#694 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
4.1k
派生
436
PR 合并指标
30 天内没有已合并 PR

描述

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`

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。