Skip to content

lib es6 loses window and other dom stuff #9500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
basarat opened this issue Jul 4, 2016 · 2 comments
Closed

lib es6 loses window and other dom stuff #9500

basarat opened this issue Jul 4, 2016 · 2 comments
Labels
Question An issue which isn't directly actionable in code

Comments

@basarat
Copy link
Contributor

basarat commented Jul 4, 2016

ts:

console.log(window);

tsconfig.json:

{
  "compilerOptions": {
    "lib": [
      "es6"
    ]
  }
}

compile:

tsc -p .

Expected behavior:
Works!

Actual behavior:
Error cannot find name window.

refs #6974 🌹

@mhegazy
Copy link
Contributor

mhegazy commented Jul 4, 2016

you have to choose it. so

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

here are more details:

  • es6/es5/es2015/es2016/es2017 -- built in JS definitions.
  • dom -- DOM definitions
  • webworkers -- Web worker definitions
  • scripthost -- widows Script Host

complete list is in https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#including-built-in-type-declarations-with---lib

@mhegazy mhegazy added the Question An issue which isn't directly actionable in code label Jul 4, 2016
@mhegazy mhegazy closed this as completed Jul 4, 2016
@basarat
Copy link
Contributor Author

basarat commented Jul 4, 2016

Thanks for that. I've fixed up my understanding / code etc. Also mentioned it here : https://basarat.gitbooks.io/typescript/content/docs/types/lib.d.ts.html#lib-option

Minor: the link https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#including-built-in-type-declarations-with---lib mentions DOM if you are working on a node project using --lib es5,es6. Having a look at the code es6 automatically references es5 (as seen here) so really it should be just --lib es6.

That said I'd PR but it seems its not linked to the page here : https://github.com/Microsoft/TypeScript-wiki/blob/master/What's-new-in-TypeScript.md 🌹

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

2 participants