-
-
Notifications
You must be signed in to change notification settings - Fork 50
Description
Is this request related to a problem? Please describe.
In short, this is to go from const foo = {...}
to const foo: Thinginator<Thing | string> = {...}
.
Pretty often I find myself seeing what type is inferred for my variables. The type inference usually works great, but here are some use cases where I like to type out the explicit type:
- for clarity, an explicit type can help the reader understand better or more quickly
- sometimes the type inference is misleading or it could be written in a clearer way
For functions it's already possible to add the return type with another refactoring.
Describe the solution you'd like
I would like to have a refactoring for this, such as "Add explicit type" or "Add type"
Additional context
Currently I do this by hovering the variable name with my mouse in order to bring up this popup (can also do it with with ⌘K ⌘I
), and then selecting the contents with the mouse to copy them with ⌘C
😄
Here's a picture:
To be clear, here's what I would like to see after applying a refactoring for this: