neoclide / coc-tsserver

Tsserver extension for coc.nvim that provide rich features like VSCode for javascript & typescript
MIT License
1.05k stars 68 forks source link

refactor: Disables type acquisition by default #320

Closed rschristian closed 2 years ago

rschristian commented 2 years ago

Closes #316

Automatic type acquisition is currently horribly flawed in that it does not check that it installs a correct or matching version of the types for the module in use. If the user has no guarantee that the types package installed at least is supposed to match the version of the module they're using, this can be problematic if not dangerous.

For example, as mentioned in #316, I'm running Node v14, yet given types for Node built-ins that only exist v15+. While this creates a poor editor experience, as you cannot actually trust that you are returned correct warnings/errors, this gets dangerous in crypto and validation areas. If you're running v1 of a library while @types has a v2, you will not get the definitions or descriptions to match what version you're using. Depending on the API changes, this can be very dangerous.

While I certainly see value in the option, I think that until it's improved it should be disabled by default. I could be in the minority in thinking as much, but wanted to put this together to at least get thoughts.

rschristian commented 2 years ago

Side note: While looking through, I found the following line which I believe is worded incorrectly, but I'm unfamiliar with nvm.

https://github.com/neoclide/coc-tsserver/blob/master/Readme.md?plain=1#L26-L29

Configure the disabling of automatic types to false, to disable automatic typings installation? Sounds backwards to me.