Sorry I am new in Javascript and Typescript.
in Swift using Xcode IDE, if I make a class, then If I make an instance, it will have its parameter name as a guide in the constructor, like the image below, so I will not put the wrong value in the constructor
but if I use Typescript and do the same thing, I will not have that parameter guide like this
it is easy if the class only has 2 properties like that, but if it has more than 10 properties then it will be confusing, I often put the wrong argument
is there a way to make something like that? VS Code extension or whatever it is. please help :)
class User {
name: string
age: number
constructor(name: string, age: number) {
this.name = name;
this.age = age;
}
}
const someone = new User("John Doe", 12);
question from:
https://stackoverflow.com/questions/66058954/can-i-have-a-typescript-class-constructor-that-has-input-parameter-guide 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…