"Insert type" quick fix #8
Comments
That will be great indeed! We need to sort out #3 before we can do that. My main blocker today is to get access to TS inferred type at the cursor position, from the extension 🤔 |
https://github.com/MartinJohns/vscode-inline-types/ Here is an extension that shows inferred types in code lens. But if I understand they just parse ts files by themselves. |
Yes, I went basically in the same direction using the For the moment it's also limited to the current file, but I guess that's a problem we'll be able to solve after. We're working on implementing #3. From there, I guess this feature will be easier to build. |
IMO, this feature is ready to be implemented thanks to the TypeChecker. We have proved with #3 that we can infer types appropriately. There's everything we need to insert the inferred type 👍 I can provide some guidance for anyone who'd like to do it. Otherwise it will wait until we tackle it with @fabien0102 (we pair-prog every week to implement features, but we mostly focus on https://github.com/nicoespeon/abracadabra to be honest). |
Hey, thanks for reporting but it's been a while since I updated this extension and I'm not planning to do this in the foreseeable future. I'm archiving the extension 👍 |
Is this request related to a problem? Please describe.
Typescript can infer a lot of things and this helps with rapid development, but at some stage I usually like to put more types on my implicitly typed variables. And this kind of quick fix would be of a great help.
Describe the solution you'd like
Suppose we have implicitly typed variables especially in the form of destructuring.
While cursor is inside
const
keyword there will be a quick fix "Insert type" that can add type like thisThis is the most complicated, but real world case. I'm trying to convert function with implicitly typed positional arguments into function that takes an object as an argument and this kind of quick fix would help me a lot.
Additional context
It would be great if this quick fix will be able to add types to any implicitly typed variable or function or object definition.
I think this could reuse some code from #3 feature request
The text was updated successfully, but these errors were encountered: