After watching some conference talks on YouTube I thought I would try giving it a go.
I ran into this issue though when playing around with it:
https://github.com/denoland/deno/issues/3793#issuecomment-578533918
One of the core tenants of Deno is that Deno should be browser compatible:
https://youtu.be/z6JRlx5NC9E (11:55)
Currently by default the tsconfig will cause errors to be thrown if you use variables like document and window.
If being browser compatible is one of Deno's core tenants though, shouldn't it have the "dom" lib active in it's default tsconfig?
Yea makes sense to me.
This is the reverse of what we mean by browser compatibility. Deno doesn't have a document and it compiles stuff it's supposed to be able to run.
Maybe you just meant the tsconfig used for deno bundle? See https://github.com/denoland/deno/issues/3793#issuecomment-578550811.
Maybe you just meant the tsconfig used for deno bundle?
That was what essentially inspired this issue. If I run deno bundle I believe it should be able bundle browser based code.
If I use the Deno.bundle() API in a file that is run using deno run then that should be able to understand browser based code as well by default.
As a temporary fix, I found that appending this at the top of the file works (though VSCode/non-deno-typescript will throw errors).
/// <reference lib="https://raw.githubusercontent.com/microsoft/TypeScript/master/lib/lib.dom.d.ts" />
@ry, no I would rather deliver #3726 and only have these apply to the runtime compiler APIs... Allowing other libs through that Deno doesn't support itself and typechecking against it erodes the value of TypeScript build into Deno IMO.
@kitsonk You make a good point that Deno shouldn't accept code that it can't run. I retract my "makes sense" comment above. I think we all agree that we need to make a non-buggy workflow for users to have DOM APIs in their isomorphic apps.
@PandawanFr I actually think that solution is pretty cool....
Ok so the answer to the question is:
No, Deno doesn't have a DOM so the DOM lib shouldn't be applied by default.
@Dan503, yes, but we should have a way to support including it in some fashion. As mentioned in #3726, I am starting working on a solution.
So does that mean this issue should be reopened?
No, as we don't want it to be defaulted to be on. Closing #3726 should meet everyones use case in a way that is supportable the long term.
Most helpful comment
That was what essentially inspired this issue. If I run
deno bundleI believe it should be able bundle browser based code.