0

is it possible to get all the public variable's name of interface or class?

He is the interface that I am using:

export interface PeriodicElement {
  name: object;
  position: number;
  weight: number;
  symbol: string;
}

Expected output is: name, position, weight, symbol.

I can define one array which has all variable name, but I am curious to know if we have anything like fetching variable names.

Update

Just checked the other possible duplicate link. But the solution suggests to create new instance of class, I don't want to do that. I want to have the variable name of interface without any instantiation.

  • How do you think this could work? If you just define a class, without referencing it or create an object you can't access it. It isn't even in your memory. –  Jun 12 '18 at 14:01
  • Is it possible if we can reference it? I don't want to create instance. There are various alternatives, but I wanted to know if I can do without instantiation. – Pavankumar Shukla Jun 12 '18 at 14:08

0 Answers0