sourcegraph / javascript-typescript-langserver

JavaScript and TypeScript code intelligence through the Language Server Protocol
https://sourcegraph.com
Apache License 2.0
793 stars 72 forks source link

Libraries aren't automatically included when a high target is selected #608

Open nponeccop opened 5 years ago

nponeccop commented 5 years ago

Expected behavior:

Whenever a tsconfig.json works with tsc, it works with langserver as well. E.g. it doesn't show errors on files which build with tsc just fine.

Actual behavior:

If I have a modern target in tsconfig.json, tsc includes the relevant libs automatically while langserver doesn't and shows an error because it doesn't recognize Map and Promise.

Detailed description:

I have the following tsconfig.json:

{
  "compilerOptions": {
    "target": "es2019",
    "module": "commonjs",
    "lib": ["es2015"],
    "strict": true,
    "esModuleInterop": true
  }
}

Which works both with tsc -p . and langserver.

However, when I delete the lib line, the langserver stops recognizing the library features such as Promise and Map.