How can I get the type of User.name
?
interface User {
id: number;
name: string;
}
TY
CodePudding user response:
Some ways
First : not recomended . USER.name = (((every thing you want))) and if it throws an error ,it says its type by that error details.
Second : select the word((( USER.na》|《me))) and press f12 to see its Ref or type directly.
This 》|《 is sample of your mouse cursor .I mean select the word ((name)) or ((USER)) where you are using it
CodePudding user response:
console.log(typeof user[name]);