acacode / acacode/swagger-typescript-api

header in baseApiParams has wrong type in Typescript

オープン
#694 コメント 0 件 リアクション 1 件 担当者 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 を短くまとめたダイジェスト。