“Live up to the time, the creation of non-stop, this article is participating in 2021 year-end summary essay competition”

I was going to write a new project with TS + Vue, and suddenly VS Code has a Quick Fix… This function, this function needs to match volar, because I did not see it when using Vetur, when using TS, it can make people have the illusion of using IDEA, that is, More actions… , you can even change the hotkey to Alt + Enter and it will be exactly the same as IDEA (of course not as many solutions and hints as IDEA)

The solution is this

axios
  .post('/api/user/register', ob)
  .then((res: { data: { data: string; msg: any } }) = >{... }Copy the code

What I’m actually returning back on the back end is a common Result base class, which looks like this

public class CloudResult<T> {
  private int code;
  private String msg;
  private T data;
  // constructors, getters, and setters are not posted
}
Copy the code

Supplement back is about the same, or very good use

Of course, not all errors have corresponding solutions (to be honest, many ideas do not have either), such as this one

I’ve also found a number of other features like class generating getters/setters for variables. See the Vs Code documentation for more TypeScript support

Pay attention to

Don’t think this is useless, because it will have an error at compile time and may not run (when I use vue-CLI), like the following error, I have been searching for a long time and found a bunch of none, Json to get rid of type checking. (I’m guessing you disable type checking. What ts do you still use?) I could have saved a lot of development time if I had just had a hint and a solution

Also don’t think configuration is too troublesome, too troublesome should use Webstorm, configure your IDE is also to improve the coding efficiency

Vs Code Alt + Enter has a lot of conflicts, there are plug-ins, there are vs Code native, but it can be used, just do not know when to use it suddenly strange