web-std / io

Web standard IO APIs implemented for nodejs
92 stars 31 forks source link

Improve headers types #64

Open StarpTech opened 2 years ago

StarpTech commented 2 years ago

Headers supports an array of values new Headers({ "foo": ["a", "b"] }) but this isn't reflected in the types. It results in { "foo": "a,b" }.

Would you accept a PR?

Gozala commented 1 year ago

Hey @StarpTech having more accurate types would be awesome, that said I'm not sure if diverging from the stock TS types would be a good idea and currently unfortunately this is what I see in TS playground

image

I think this should be fixed on TS side, this library simply tells TS that Headers come from globals (even though node mapped version does something else)

https://github.com/web-std/io/blob/3c20536d628e6c5e592d7d9760d7008ab6bbb7b0/packages/fetch/src/lib.js#L3