Reputation: 15336
I tried to bundle TypeScript with Deno, but it seems like it doesn't have the browser types.
I would like to use Deno as a simple option instead of WebPack etc.
console.log(window.document)
deno bundle browser/play.ts
Error
error: TS2339 [ERROR]: Property 'document' does not exist on type 'Window & typeof globalThis'.
console.log(window.document)
Upvotes: 0
Views: 593
Reputation: 145
These are the compiler options I use to target the browser:
{
"compilerOptions": {
"lib": [
"dom",
"dom.iterable",
"dom.asynciterable",
"deno.ns"
]
},
}
Upvotes: 1
Reputation: 15336
The following tsconfig.json
option needed to be added to Deno (and also added to VSCode deno config).
{
"compilerOptions": {
"lib": ["dom", "deno.ns"]
}
}
Upvotes: 2