sourcegraph / javascript-typescript-langserver

JavaScript and TypeScript code intelligence through the Language Server Protocol

Home Page:https://sourcegraph.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

nponeccop opened this issue · comments

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.