sholladay / pogo

Server framework for Deno
Mozilla Public License 2.0
482 stars 32 forks source link

Cannot find name 'HeadersInit' in response.ts #23

Closed bohjak closed 4 years ago

bohjak commented 4 years ago

It seems that headers inside the ResponseOptions interface is using a type that is not defined in the file: HeadersInit. I fixed it locally by replacing it with __domTypes.HeadersInit, which is used by the Headers constructor:

const Headers: __domTypes.HeadersConstructor
new (init?: __domTypes.Headers | [string, string][] | Record<string, string> | undefined) => __domTypes.Headers

I also noticed that in the commit history this type was used at one point. Was there a purpose to replacing it? Otherwise I can create a PR with the fix.

sholladay commented 4 years ago

I think your Deno version is out of date. __domTypes.HeadersInit doesn't exist anymore as of Deno 0.41.0. I made the change in commit https://github.com/sholladay/pogo/pull/14/commits/4ca49964f734ee4fb037a4772fc21c33cb7d31b3 while working on PR #14, soon after updating the version of Deno used in CI.

For what it's worth, I did update the support statement in the README:

Supports Deno v0.41.0 and higher.

I know it's hard to notice these things, though. Deno needs better tooling around this. We basically need the equivalent of npm's engineStrict.

I'm going to close this issue since I think you just need to update Deno, but please do let me know if I am wrong! :)