acacode / acacode/swagger-typescript-api

header in baseApiParams has wrong type in Typescript

Abierto
#694 0 comentarios 1 reacción 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
4.1k
Forks
436
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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`

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.