Deno: What "lib" values are compatible with Deno?

Created on 3 Mar 2020  Â·  10Comments  Â·  Source: denoland/deno

Hi,

in my tsconfig.json:

"compilerOptions": {
  "lib": ["esnext", "dom", "deno.ns"]
}

...and with Deno 0.35.0:

error TS2488: Type 'Headers' must have a '[Symbol.iterator]()' method that returns an iterator.

â–º https://deno.land/std/http/io.ts:135:24

135   for (const [k, v] of result) {
                           ~~~~~~

error TS2488: Type 'Headers' must have a '[Symbol.iterator]()' method that returns an iterator.

â–º https://deno.land/std/http/io.ts:206:30

206   for (const [key, value] of trailers) {
                                 ~~~~~~~~

error TS2488: Type 'Headers' must have a '[Symbol.iterator]()' method that returns an iterator.

â–º https://deno.land/std/http/io.ts:260:30

260   for (const [key, value] of headers) {
bug

Most helpful comment

I will wait for 0.36 then ;-)

All 10 comments

What does the following do?

"compilerOptions": {
  "lib": ["esnext", "dom", "dom.iterable", "deno.ns"]
}

What does the following do?

46 errors in total. The Headers missing a [Symbol.iterator] is still present, plus a lot of duplicate definition errors. I can post/link a full report, but I do not think it brings a lot to the discussion.

Ok, we need to clean up deno.ns then, so it is compatible with dom and dom.iterable, but it also looks like there are potentially non-spec features that some of the std modules are using around our window globals, which isn't good.

😖

@ondras do you have a main module you could share? If not, I can try to create something.

Actually, @ondras I _was_ right. dom.iterable does fix the issue, but only if Deno actually included it properly in the binary. It was a copy of dom which then only created a whole slew of conflicts instead of actually adding the iterable interfaces to the DOM.

I tried an example server that included std/http and was getting the same errors you got before #4242, so I am pretty sure it should also fix your issue as well once merged.

@ondras do you have a main module you could share? If not, I can try to create something.

I only imported the std/http module, the file is empty otherwise.

@kitsonk I am getting about 50 of these index signature errors using your compileroptions:

error TS2374: Duplicate string index signature.
â–º $asset$/lib.dom.iterable.d.ts:6944:5
6944 [name: string]: any;

@timonson I assume you are using the patch in #4242, it fixes the issue. It isn't merged yet.

@kitsonk thanks! Is there a straightforward way I can test this?

@ondras you would have to build off master, but your code before with the dom.iterable lib should _just work_.

I will wait for 0.36 then ;-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xueqingxiao picture xueqingxiao  Â·  3Comments

ry picture ry  Â·  3Comments

watilde picture watilde  Â·  3Comments

justjavac picture justjavac  Â·  3Comments

benjamingr picture benjamingr  Â·  3Comments