question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Canary] DOM is not being included when declared as a lib in tsconfig

See original GitHub issue

Describe the bug deno-ts reports problems whenever dom types are used even when dom is declared as a lib in a tsconfig file.

Example of problem reported: Cannot find name 'document'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'.

Including ESNext, deno.window or es6 (and others) as libs seemingly work as intended so this seems to be specifically related to including dom within either the extension or the language service as using the same tsconfig with the --config flag for bundling works.

Used Configs vscode settings.json:

{
  "deno.config": "./tsconfig.json",
  "deno.enable": true,
  "deno.lint": true,
}

tsconfig.json:

{
    "compilerOptions": {
        "lib": [ "ESNext",  "dom", ],
    },
}

Expected behavior

Deno should not report problems for DOM types when included as a lib within a tsconfig file.

Versions vscode: 1.54.0-insider (Also checked on 1.53.0) deno: 1.7.2 (release, x86_64-pc-windows-msvc) extension: denoland.vscode-deno-canary 0.0.8

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
esquevincommented, Feb 8, 2021

Encountering the exact same issue.

Currently the extension is telling me Cannot find name 'console'. Do you need to change your target library? Try changing the lib compiler option to include 'dom'.deno-ts(2584)

Even though I got

  "compilerOptions": {
    "jsx": "react",
    "jsxFactory": "h",
    "lib": ["dom", "ESNext"],
    "noFallthroughCasesInSwitch": true,
    "noUnusedLocals": true
  }
}```

I'm sure that my tsconfig.json is properly loaded since when I disable the JSX configuration line, all my JSX is reported as error
1reaction
kitsonkcommented, Feb 19, 2021

I believe this is now fixed in 3.0.1 and Deno 1.7.5.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TSConfig Option: lib - TypeScript
Your program doesn't run in a browser, so you don't want the "dom" type definitions; Your runtime platform provides certain JavaScript API objects...
Read more >
In TypeScript config file 'tsconfig.json', is it redundant to set 'lib ...
In TypeScript config file 'tsconfig.json', is it redundant to set 'lib' compiler option to both 'dom' AND 'dom.iterable'? · tl;dr: No, specifying ...
Read more >
Set up a Kotlin/JS project
The dependency on the Kotlin/JS standard library is mandatory for all Kotlin/JS projects, and as such is implicit – no artifacts need to...
Read more >
Semantic Versioning for TypeScript Types - Ember RFCs
While this RFC is being authored in the context of Ember.js' adoption of ... Changes to these do not constitute breaking changes—but library...
Read more >
lib.d.ts - TypeScript Deep Dive - Gitbook
You can exclude this file from the compilation context by specifying the --noLib compiler command line flag (or "noLib" : true in tsconfig.json...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found